From: 咸�9�5 <2437705447@qq.com>
To: Daniel Gustafsson <daniel@yesql.se>
To: Jet Zhang <jet.cx.zhang@hotmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: Bug of psql meta-command \sf & \sv
Date: Wed, 27 Sep 2023 20:35:44 +0800
Message-ID: <tencent_3D9ADA8DCC85FE27FAE6F544ECBBAC5FA009@qq.com> (raw)
In-Reply-To: <52B143ED-EBAF-456E-B159-21FC77BB7B98@yesql.se>
References: <TY3P286MB259429FE5F1A31B3D7A2ABD2D5C2A@TY3P286MB2594.JPNP286.PROD.OUTLOOK.COM>
<52B143ED-EBAF-456E-B159-21FC77BB7B98@yesql.se>
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.)
咸?
2437705447@qq.com
------------------ Original ------------------
From: "Daniel Gustafsson" <daniel@yesql.se>;
Date: Wed, Sep 27, 2023 05:13 PM
To: "Jet Zhang"<jet.cx.zhang@hotmail.com>;
Cc: "pgsql-bugs@lists.postgresql.org"<pgsql-bugs@lists.postgresql.org>;
Subject: Re: Bug of psql meta-command \sf & \sv
> On 27 Sep 2023, at 11:06, Jet Zhang <jet.cx.zhang@hotmail.com> wrote:
>
> Hi there,
>
> The psql meta-commands \sf and \sv have a minor bug, for example:
>
> postgres=# CREATE PROCEDURE test () AS $$ BEGIN NULL; END; $$ LANGUAGE plpgsql; -- create a procedure
> postgres=# \sf test
> CREATE OR REPLACE PROCEDURE public.test()
> LANGUAGE plpgsql
> AS $procedure$ BEGIN NULL; END; $procedure$
>
> We can use \sf to check the souce of test, but if we use:
> postgres=# \sf test;
> 2023-09-27 16:51:58.632 CST [3460153] ERROR: function "test;" does not exist at character 8
> 2023-09-27 16:51:58.632 CST [3460153] STATEMENT: SELECT 'test;'::pg_catalog.regproc::pg_catalog.oid
> ERROR: function "test;" does not exist
>
> 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: function "test" does not exist
postgres=# \sf test;
CREATE OR REPLACE FUNCTION public."test;"()
RETURNS text
LANGUAGE plpgsql
AS $function$ begin null; end; $function$
postgres=#
--
Daniel Gustafsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: 2437705447@qq.com, daniel@yesql.se, jet.cx.zhang@hotmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: Bug of psql meta-command \sf & \sv
In-Reply-To: <tencent_3D9ADA8DCC85FE27FAE6F544ECBBAC5FA009@qq.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox