On 01/05/2014 08:43 PM, Keith Fiske wrote:
I can't remove the quote_literal() because the value could potentially be a string, time, or number. Without the loop, quote_literal() handles the variable being any one of those types without any issues and quotes (or doesn't) as needed.
Well I tried it in your example function and it seemed to work. I don't think it is quote_literal that is the problem, it is the assignment to v_sql. In the FOREACH it seems v_sql is not being replanned. In the other loop there two instances of it and they segregated by type at the start so they do not suffer the planning issue with types.
-- Keith Fiske Database Administrator OmniTI Computer Consulting, Inc. http://www.keithf4.com
-- Adrian Klaver adrian.klaver@xxxxxxxxx -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general