Re: Bug of psql meta-command \sf & \sv - Mailing list pgsql-bugs

From Daniel Gustafsson
Subject Re: Bug of psql meta-command \sf & \sv
Date
Msg-id 52B143ED-EBAF-456E-B159-21FC77BB7B98@yesql.se
Whole thread Raw
In response to Bug of psql meta-command \sf & \sv  (Jet Zhang <jet.cx.zhang@hotmail.com>)
Responses RE: Bug of psql meta-command \sf & \sv
Re: Bug of psql meta-command \sf & \sv
List pgsql-bugs
> 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




pgsql-bugs by date:

Previous
From: Jet Zhang
Date:
Subject: Bug of psql meta-command \sf & \sv
Next
From: Jet Zhang
Date:
Subject: RE: Bug of psql meta-command \sf & \sv