pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marco Lechner <mlechner@bfs.de>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: AW: Is there a bug in psql? (SELECT ''';)
Date: Wed, 31 May 2023 07:23:46 +0000
Message-ID: <9553ca9840a24e1ba215cf970b98a1f5@bfs.de> (raw)
In-Reply-To: <tencent_27D6CDAD1699DE403EC409B96949CBB8CC0A@qq.com>
References: <tencent_27D6CDAD1699DE403EC409B96949CBB8CC0A@qq.com>

You have to mask the single quote:
https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS

Von: Wen Yi <896634148@qq.com>
Gesendet: Mittwoch, 31. Mai 2023 09:17
An: pgsql-general <pgsql-general@lists.postgresql.org>
Betreff: Is there a bug in psql? (SELECT ''';)

Hi team,
when I learn the postgres, I try to store the ' into the database,
but something unexpected happend.

postgres=# CREATE TABLE test (str varchar);
CREATE TABLE
postgres=# INSERT INTO test values (''');
postgres'# SELECT * FROM test;
postgres'# exit
Use control-D to quit.
postgres'# \q
Use control-D to quit.
postgres'#
\q
bash-5.1$

And I do another test

postgres=# SELECT ''';
postgres'# exit
Use control-D to quit.
postgres'# \q
Use control-D to quit.
postgres'#
\q
bash-5.1$

Is there a bug in psql?

Yours,
Wen Yi

Message-ID: <9553ca9840a24e1ba215cf970b98a1f5@bfs.de>
Permalink:  ../9553ca9840a24e1ba215cf970b98a1f5@bfs.de/
Also on:    postgresql.org/message-id/9553ca9840a24e1ba215cf970b98a1f5@bfs.de

 · 

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: mlechner@bfs.de
  Subject: Re: Is there a bug in psql? (SELECT ''';)
  In-Reply-To: <9553ca9840a24e1ba215cf970b98a1f5@bfs.de>
  References: <tencent_27D6CDAD1699DE403EC409B96949CBB8CC0A@qq.com> <9553ca9840a24e1ba215cf970b98a1f5@bfs.de>

* 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