Re: pl/pgSQL variable substitution
| От | Tom Lane |
|---|---|
| Тема | Re: pl/pgSQL variable substitution |
| Дата | |
| Msg-id | 6478.1297954355@sss.pgh.pa.us обсуждение |
| Ответ на | pl/pgSQL variable substitution (Jeremy Palmer <JPalmer@linz.govt.nz>) |
| Список | pgsql-general |
Jeremy Palmer <JPalmer@linz.govt.nz> 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
В списке pgsql-general по дате отправления: