Re: SELECT in VCHAR column for strings with TAB

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SELECT in VCHAR column for strings with TAB
Дата
Msg-id 1558492.1623333002@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SELECT in VCHAR column for strings with TAB  (Matthias Apitz <guru@unixarea.de>)
Список pgsql-general
Matthias Apitz <guru@unixarea.de> writes:
> I want to search in a VCHAR column for a string with two TAB at the end.
> I tried some things w/o any luck, like:

> select * from acq_vardata where name=concat('Test202112', 9, 9);
> select * from acq_vardata where name=concat('Test202112', '\t\t');

By default, backslash is not magic in SQL literals.  The right way
to spell that is something like

select * from acq_vardata where name = E'Test202112\t\t';

See the discussion of "escape strings" in

https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS

            regards, tom lane



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

Предыдущее
От: Ray O'Donnell
Дата:
Сообщение: Re: SELECT in VCHAR column for strings with TAB
Следующее
От: Hannes Kühtreiber
Дата:
Сообщение: Re: Logical Replication: SELECT pg_catalog.set_config Statement appears to be hanging