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

Started by 咸🐟over 2 years ago1 messagesbugs
Jump to latest
#1咸🐟
2437705447@qq.com

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"

咸?
2437705447@qq.com

 

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

On Wed, 27 Sep 2023 at 20:35, 咸🐟 <2437705447@qq.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;!@#$%^&amp;*()" ("*&amp;-=+" int, "?&gt;.,\/" text);
CREATE TABLE
postgres=# \d "<&gt;!@#$%^&amp;*()"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Table "public.<&gt;!@#$%^&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;!@#$%^&amp;*()" VALUES (1, 'hello world');
INSERT 0 1
postgres=# SELECT * FROM&nbsp; "<&gt;!@#$%^&amp;*()";
&nbsp;*&amp;-=+ |&nbsp;&nbsp; ?&gt;.,\/
-------+-------------
&nbsp;&nbsp;&nbsp;&nbsp; 1 | hello world
(1 row)

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