1. A method of enforcing data privileges, comprising: receiving a query from a user to access a multi-tenant database; accessing, via a metadata security engine, a set of permissions specifying the user's data privileges to the multi-tenant database; identifying a set of objects, the set of objects including at least one object containing data matching the query in the multi-tenant database; authenticating, via the metadata security engine, the user's data privileges to at least one column of at least one object in the set of objects containing data matching the query, the metadata security engine being independent of the multi-tenant database; for each object in the set of objects having the user's data privileges authenticated, substituting one or more table-valued functions associated with the received query based on the set of permissions, the one or more table-valued functions conforming the at least one object containing data matching the query with the set of permissions specifying the user's data privileges, the substituting of the one or more table-valued functions comprising: identifying a first table in a FROM statement associated with the received query; replacing the first table with a first table-valued function; determining if the first table is the last table; replacing an INNER JOIN with LEFT OUTER JOIN when the first table is not the last table; determining whether a second table's permissions are covered by the first table-valued function; and replacing the second table with a second table-valued function when the second table's permissions are not covered by the first table-valued function; and transmitting a response to the received query, the response to the received query including the one or more table-valued functions for each object in the set of objects having the user's data privileges authenticated.