AW: Is there a bug in psql? (SELECT ''';)

From: Marco Lechner <mlechner(at)bfs(dot)de>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: AW: Is there a bug in psql? (SELECT ''';)
Date: 2023-05-31 07:23:46
Message-ID: 9553ca9840a24e1ba215cf970b98a1f5@bfs.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Von: Wen Yi <896634148(at)qq(dot)com>
Gesendet: Mittwoch, 31. Mai 2023 09:17
An: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Wei Wang (Fujitsu) 2023-05-31 09:02:22 RE: Support logical replication of DDLs
Previous Message Wen Yi 2023-05-31 07:17:14 Is there a bug in psql? (SELECT ''';)