1. A computer implemented method comprising: a SQL compiler rewriting a certain query that includes a first function to generate a rewritten query, wherein the certain query applies certain data to said first function, wherein rewriting the query includes: during compile time, said SQL compiler determining that said certain data is dynamically typed; and in response to determining that said certain data is dynamically typed, said SQL compiler replacing said first function with a user-defined polymorphic function, said rewritten query applying certain data to said user-defined polymorphic function and typing said certain data as global data type representing a plurality of specific data types.