回复: Bug of psql meta-command \sf & \sv

From: 咸🐟 <2437705447(at)qq(dot)com>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Jet Zhang <jet(dot)cx(dot)zhang(at)hotmail(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: 回复: Bug of psql meta-command \sf & \sv
Date: 2023-09-28 02:09:21
Message-ID: tencent_B0FA5FAF0F5A0FDE1ED77A086ABBBDD1FC05@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I think there is a problem with this comparison.
\sf test;&nbsp; is not equal to \sf "test;"&nbsp;
should test&nbsp; \sf "test;";

postgres=# cretae table "tB"(a int, b int);
2023-09-28 09:50:41.637 CST [1480913] ERROR:&nbsp; syntax error at or near "cretae" at character 1
2023-09-28 09:50:41.637 CST [1480913] STATEMENT:&nbsp; cretae table "tB"(a int, b int);
ERROR:&nbsp; syntax error at or near "cretae"
LINE 1: cretae table "tB"(a int, b int);
&nbsp; &nbsp; &nbsp; &nbsp; ^
postgres=# create table "tB"(a int, b int);
CREATE TABLE
postgres=# select * from tB;
2023-09-28 09:50:57.196 CST [1480913] ERROR:&nbsp; relation "tb" does not exist at character 15
2023-09-28 09:50:57.196 CST [1480913] STATEMENT:&nbsp; select * from tB;
ERROR:&nbsp; relation "tb" does not exist
LINE 1: select * from tB;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^
postgres=# select * from tb;
2023-09-28 09:51:00.053 CST [1480913] ERROR:&nbsp; relation "tb" does not exist at character 15
2023-09-28 09:51:00.053 CST [1480913] STATEMENT:&nbsp; select * from tb;
ERROR:&nbsp; relation "tb" does not exist
LINE 1: select * from tb;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^
postgres=# select * from "tB";
&nbsp;a | b&nbsp;
---+---
(0 rows)

In PostgreSQL, tB is not equal to "tB"

咸?
2437705447(at)qq(dot)com

&nbsp;

------------------&nbsp;原始邮件&nbsp;------------------
发件人: "Japin Li" <japinli(at)hotmail(dot)com&gt;;
发送时间:&nbsp;2023年9月27日(星期三) 晚上10:16
收件人:&nbsp;"咸🐟"<2437705447(at)qq(dot)com&gt;;
抄送:&nbsp;"Daniel Gustafsson"<daniel(at)yesql(dot)se&gt;;"Jet Zhang"<jet(dot)cx(dot)zhang(at)hotmail(dot)com&gt;;"pgsql-bugs"<pgsql-bugs(at)lists(dot)postgresql(dot)org&gt;;
主题:&nbsp;Re: Bug of psql meta-command \sf &amp; \sv

On Wed, 27 Sep 2023 at 20:35, 咸🐟 <2437705447(at)qq(dot)com&gt; wrote:
&gt; https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
&gt; I don't think this meets the documentation's definition of an identifier.&amp;nbsp; Semicolons should not be used this way here.(Excuse me, I need to test the email function.)
&gt;

In PostgreSQL, quoted identifiers can contain any character, except the
character with code zero.&nbsp; For example:

postgres=# CREATE table "<&gt;!(at)#$%^&amp;*()" ("*&amp;-=+" int, "?&gt;.,\/" text);
CREATE TABLE
postgres=# \d "<&gt;!(at)#$%^&amp;*()"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Table "public.<&gt;!(at)#$%^&amp;*()"
&nbsp;Column |&nbsp; Type&nbsp;&nbsp; | Collation | Nullable | Default
--------+---------+-----------+----------+---------
&nbsp;*&amp;-=+&nbsp; | integer |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
&nbsp;?&gt;.,\/ | text&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |

postgres=# INSERT INTO "<&gt;!(at)#$%^&amp;*()" VALUES (1, 'hello world');
INSERT 0 1
postgres=# SELECT * FROM&nbsp; "<&gt;!(at)#$%^&amp;*()";
&nbsp;*&amp;-=+ |&nbsp;&nbsp; ?&gt;.,\/
-------+-------------
&nbsp;&nbsp;&nbsp;&nbsp; 1 | hello world
(1 row)

--
Regrads,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2023-09-28 02:27:34 Re: FW: Query execution failure
Previous Message Tom Lane 2023-09-28 01:06:13 Re: FW: Query execution failure