pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedSELECT in VCHAR column for strings with TAB
3+ messages / 3 participants
[nested] [flat]
* SELECT in VCHAR column for strings with TAB
@ 2021-06-10 13:30 Matthias Apitz <guru@unixarea.de>
2021-06-10 13:39 ` Re: SELECT in VCHAR column for strings with TAB Ray O'Donnell <ray@rodonnell.ie>
2021-06-10 13:50 ` Re: SELECT in VCHAR column for strings with TAB Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 3+ messages in thread
From: Matthias Apitz @ 2021-06-10 13:30 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hello,
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');
Any ideas? Thx
matthias
--
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
¡Con Cuba no te metas! «» Don't mess with Cuba! «» Leg Dich nicht mit Kuba an!
http://www.cubadebate.cu/noticias/2020/12/25/en-video-con-cuba-no-te-metas/
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: SELECT in VCHAR column for strings with TAB
2021-06-10 13:30 SELECT in VCHAR column for strings with TAB Matthias Apitz <guru@unixarea.de>
@ 2021-06-10 13:39 ` Ray O'Donnell <ray@rodonnell.ie>
1 sibling, 0 replies; 3+ messages in thread
From: Ray O'Donnell @ 2021-06-10 13:39 UTC (permalink / raw)
To: Matthias Apitz <guru@unixarea.de>; pgsql-general@lists.postgresql.org
On 10/06/2021 14:30, Matthias Apitz wrote:
>
> Hello,
>
> 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');
Maybe use a regular expression?
https://www.postgresql.org/docs/13/functions-matching.html
Ray.
--
Raymond O'Donnell // Galway // Ireland
ray@rodonnell.ie
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: SELECT in VCHAR column for strings with TAB
2021-06-10 13:30 SELECT in VCHAR column for strings with TAB Matthias Apitz <guru@unixarea.de>
@ 2021-06-10 13:50 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2021-06-10 13:50 UTC (permalink / raw)
To: Matthias Apitz <guru@unixarea.de>; +Cc: pgsql-general@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-06-10 13:50 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 13:30 SELECT in VCHAR column for strings with TAB Matthias Apitz <guru@unixarea.de>
2021-06-10 13:39 ` Ray O'Donnell <ray@rodonnell.ie>
2021-06-10 13:50 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox