Re: Quoted string in select and insert

Поиск
Список
Период
Сортировка
От Bartosz Dmytrak
Тема Re: Quoted string in select and insert
Дата
Msg-id CAD8_UcazRv+k2eQxMTSz-oYWJfUxdFwJYLhtvBWNamiP7SC8ew@mail.gmail.com
обсуждение исходный текст
Ответ на Quoted string in select and insert  (Alexander Reichstadt <lxr@mac.com>)
Список pgsql-novice
Hi,
try 
 SELECT * FROM persons WHERE firstname='''Peter'''
this is tripe '


Regards,
Bartek


2012/3/2 Alexander Reichstadt <lxr@mac.com>
Hi,

I just migrated from mysql and am running into an issue I found no solution for when researching. Using the web interface I can insert values that contain single-quotes. But using the CLI I found no way to select or insert single quotes:

PetWork=# select * from persons where firstname='\'Peter\'';
Invalid command \'';. Try \? for help.
PetWork-# select * from persons where firstname='\\'Peter\\'';
Invalid command \. Try \? for help.
PetWork-# select * from persons where firstname='\\\'Peter\\\'';
Invalid command \. Try \? for help.
PetWork-# select * from persons where firstname='\\\\'Peter\\\\'';
Invalid command \. Try \? for help.
PetWork-# select * from persons where firstname='\\\\'Peter\\\\'';

On different forums the solution suggested is to prepend backslashes. But it doesn't matter how many backslashes I prepend, it always fails. What does one have to do to achieve that?

Thanks for any help


--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

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

Предыдущее
От: Alexander Reichstadt
Дата:
Сообщение: Quoted string in select and insert
Следующее
От: Piyush Lenka
Дата:
Сообщение: Restoring selected records from backup file