Jeremy Palmer <JPalmer@xxxxxxxxxxxx> writes: > When I have a query that uses DESC reserved word within the function the following variable substitution occurs: > ERROR: syntax error at or near "$1" > LINE 1: SELECT foo.bar, foo."desc" FROM foo."desc" ORDER BY foo."desc" $1 > ^ The other two responses seem to have missed the point, which is that plpgsql is substituting for something that couldn't possibly be a variable name. That is fixed as of 9.0. I'm not sure whether it solves your issue completely, though. In general, using identifiers that look like reserved words is painful --- and don't forget that in plpgsql, you have *two* sets of reserved words to worry about, the core SQL language's plus plpgsql's own. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general