Re: SELECT in VCHAR column for strings with TAB - Mailing list pgsql-general

From Tom Lane
Subject Re: SELECT in VCHAR column for strings with TAB
Date
Msg-id 1558492.1623333002@sss.pgh.pa.us
Whole thread Raw
In response to SELECT in VCHAR column for strings with TAB  (Matthias Apitz <guru@unixarea.de>)
List 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 by date:

Previous
From: Ray O'Donnell
Date:
Subject: Re: SELECT in VCHAR column for strings with TAB
Next
From: Hannes Kühtreiber
Date:
Subject: Re: Logical Replication: SELECT pg_catalog.set_config Statement appears to be hanging