Re: Bug of psql meta-command \sf & \sv

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

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.&nbsp; Semicolons should not be used this way here.(Excuse me, I need to test the email function.)

咸?
2437705447(at)qq(dot)com

&nbsp;

------------------&nbsp;Original&nbsp;------------------
From: "Daniel Gustafsson" <daniel(at)yesql(dot)se&gt;;
Date:&nbsp;Wed, Sep 27, 2023 05:13 PM
To:&nbsp;"Jet Zhang"<jet(dot)cx(dot)zhang(at)hotmail(dot)com&gt;;
Cc:&nbsp;"pgsql-bugs(at)lists(dot)postgresql(dot)org"<pgsql-bugs(at)lists(dot)postgresql(dot)org&gt;;
Subject:&nbsp;Re: Bug of psql meta-command \sf &amp; \sv

&gt; On 27 Sep 2023, at 11:06, Jet Zhang <jet(dot)cx(dot)zhang(at)hotmail(dot)com&gt; wrote:
&gt;
&gt; Hi there,
&gt;&nbsp;
&gt; The psql meta-commands \sf and \sv have a minor bug, for example:
&gt;&nbsp;
&gt; postgres=# CREATE PROCEDURE test () AS $$ BEGIN NULL; END; $$ LANGUAGE plpgsql;&nbsp;&nbsp; -- create a procedure
&gt; postgres=# \sf test
&gt; CREATE OR REPLACE PROCEDURE public.test()
&gt; LANGUAGE plpgsql
&gt; AS $procedure$ BEGIN NULL; END; $procedure$
&gt;&nbsp;
&gt; We can use \sf to check the souce of test, but if we use:
&gt; postgres=# \sf test;
&gt; 2023-09-27 16:51:58.632 CST [3460153] ERROR:&nbsp; function "test;" does not exist at character 8
&gt; 2023-09-27 16:51:58.632 CST [3460153] STATEMENT:&nbsp; SELECT 'test;'::pg_catalog.regproc::pg_catalog.oid
&gt; ERROR:&nbsp; function "test;" does not exist
&gt;&nbsp;
&gt; The \sf feedback an error.

This is not a bug, "test;" is a valid name which is distinct from test.
Semi-colon is not a meta-command terminator.

postgres=# create function "test;"() returns text as $$ begin null; end; $$ language plpgsql;
CREATE FUNCTION
postgres=# \sf test
ERROR:&nbsp; function "test" does not exist
postgres=# \sf test;
CREATE OR REPLACE FUNCTION public."test;"()
&nbsp;RETURNS text
&nbsp;LANGUAGE plpgsql
AS $function$ begin null; end; $function$
postgres=#

--
Daniel Gustafsson

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Japin Li 2023-09-27 14:16:47 Re: Bug of psql meta-command \sf & \sv
Previous Message Daniel Gustafsson 2023-09-27 12:07:16 Re: Memory leak on subquery as scalar operand