pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matthias Apitz <guru@unixarea.de>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: SELECT in VCHAR column for strings with TAB
Date: Thu, 10 Jun 2021 09:50:02 -0400
Message-ID: <1558492.1623333002@sss.pgh.pa.us> (raw)
In-Reply-To: <YMIUCkfNzewWG8Qn@c720-r368166>
References: <YMIUCkfNzewWG8Qn@c720-r368166>

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





view thread (3+ messages)

Message-ID: <1558492.1623333002@sss.pgh.pa.us>
Permalink:  ../1558492.1623333002@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1558492.1623333002@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, guru@unixarea.de
  Subject: Re: SELECT in VCHAR column for strings with TAB
  In-Reply-To: <1558492.1623333002@sss.pgh.pa.us>
  References: <YMIUCkfNzewWG8Qn@c720-r368166> <1558492.1623333002@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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