We prove a necessary and sufficient condition for a function being a polynomial function over a finite, commutative, unital ring. Further, we give an algorithm running in quasilinear time that determines whether or not a function given by its function table can be represented by a polynomial, and if the answer is yes then it provides one such polynomial.