Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrL4S-0003Ns-05 for pgsql-general@arkaria.postgresql.org; Thu, 10 Jun 2021 13:50:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lrL4Q-0008M6-Uv for pgsql-general@arkaria.postgresql.org; Thu, 10 Jun 2021 13:50:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrL4Q-0008L1-Ls for pgsql-general@lists.postgresql.org; Thu, 10 Jun 2021 13:50:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrL4O-00032h-4O for pgsql-general@lists.postgresql.org; Thu, 10 Jun 2021 13:50:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 15ADo2Cb1558493; Thu, 10 Jun 2021 09:50:02 -0400 From: Tom Lane To: Matthias Apitz cc: pgsql-general@lists.postgresql.org Subject: Re: SELECT in VCHAR column for strings with TAB In-reply-to: References: Comments: In-reply-to Matthias Apitz message dated "Thu, 10 Jun 2021 15:30:50 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1558491.1623333002.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 10 Jun 2021 09:50:02 -0400 Message-ID: <1558492.1623333002@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Matthias Apitz 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=3Dconcat('Test202112', 9, 9); > select * from acq_vardata where name=3Dconcat('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 =3D 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