Re: BUG #4944: Problems with using \set variables as strings in select statements

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #4944: Problems with using \set variables as strings in select statements
Дата
Msg-id 10370.1248705375@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #4944: Problems with using \set variables as strings in select statements  ("Bruno Scovoli Santos" <bruno.scovoli@gmail.com>)
Список pgsql-bugs
"Bruno Scovoli Santos" <bruno.scovoli@gmail.com> writes:
> brunodb=# \set nom 'Intel'
> euclidhardware=# select * from fabricantes where nome like :nom;
> ERROR:  column "intel" does not exist
> LINE 1: select * from fabricantes where nome like Intel;

If you want to put quotes in the value of a variable, you need
this
\set nom '''Intel'''
or this
\set nom '\'Intel\''
the same as you would to write a string literal containing quotes
in SQL.

            regards, tom lane

В списке pgsql-bugs по дате отправления: