I think there is a problem with this comparison.
\sf test; is not equal to \sf "test;"
should test \sf "test;";
postgres=# cretae table "tB"(a int, b int);
2023-09-28 09:50:41.637 CST [1480913] ERROR: syntax error at or near "cretae" at character 1
2023-09-28 09:50:41.637 CST [1480913] STATEMENT: cretae table "tB"(a int, b int);
ERROR: syntax error at or near "cretae"
LINE 1: cretae table "tB"(a int, b int);
^
postgres=# create table "tB"(a int, b int);
CREATE TABLE
postgres=# select * from tB;
2023-09-28 09:50:57.196 CST [1480913] ERROR: relation "tb" does not exist at character 15
2023-09-28 09:50:57.196 CST [1480913] STATEMENT: select * from tB;
ERROR: relation "tb" does not exist
LINE 1: select * from tB;
^
postgres=# select * from tb;
2023-09-28 09:51:00.053 CST [1480913] ERROR: relation "tb" does not exist at character 15
2023-09-28 09:51:00.053 CST [1480913] STATEMENT: select * from tb;
ERROR: relation "tb" does not exist
LINE 1: select * from tb;
^
postgres=# select * from "tB";
a | b
---+---
(0 rows)
In PostgreSQL, tB is not equal to "tB"
------------------ 原始邮件 ------------------
发件人: "Japin Li" <japinli@hotmail.com>;
发送时间: 2023年9月27日(星期三) 晚上10:16
收件人: "咸�9�5"<2437705447@qq.com>;
抄送: "Daniel Gustafsson"<daniel@yesql.se>;"Jet Zhang"<jet.cx.zhang@hotmail.com>;"pgsql-bugs"<pgsql-bugs@lists.postgresql.org>;
主题: Re: Bug of psql meta-command \sf & \sv
On Wed, 27 Sep 2023 at 20:35, 咸�9�5 <2437705447@qq.com> wrote:
> https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
> I don't think this meets the documentation's definition of an identifier. Semicolons should not be used this way here.(Excuse me, I need to test the email function.)
>
In PostgreSQL, quoted identifiers can contain any character, except the
character with code zero. For example:
postgres=# CREATE table "<>!@#$%^&*()" ("*&-=+" int, "?>.,\/" text);
CREATE TABLE
postgres=# \d "<>!@#$%^&*()"
Table "public.<>!@#$%^&*()"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
*&-=+ | integer | | |
?>.,\/ | text | | |
postgres=# INSERT INTO "<>!@#$%^&*()" VALUES (1, 'hello world');
INSERT 0 1
postgres=# SELECT * FROM "<>!@#$%^&*()";
*&-=+ | ?>.,\/
-------+-------------
1 | hello world
(1 row)
--
Regrads,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.