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

From: Jet Zhang <jet(dot)cx(dot)zhang(at)hotmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
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 09:25:15
Message-ID: TY3P286MB2594ABE47C8F546CD3E09E0AD5C2A@TY3P286MB2594.JPNP286.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I don’t think not a bug. As you said Semi-colon is not a meta-command terminator, but why the other meta-commands
Exp. \dt able to work with Semi-colon?

postgres=# \dt pg_class
List of relations
Schema | Name | Type | Owner
------------+----------+-------+-------
pg_catalog | pg_class | table | jet
(1 row)

postgres=# \dt pg_class;
List of relations
Schema | Name | Type | Owner
------------+----------+-------+-------
pg_catalog | pg_class | table | jet
(1 row)

[cid:image001(dot)png(at)01D80E0F(dot)FAC36F80]

章晨曦 Jet C.X. ZHANG
18657181679
易景科技 http://www.halodbtech.com
浙江省杭州市滨江区长河街道建业路511号华创大厦5层505

________________________________
From: Daniel Gustafsson <daniel(at)yesql(dot)se>
Sent: Wednesday, September 27, 2023 5:13:32 PM
To: 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

> On 27 Sep 2023, at 11:06, Jet Zhang <jet(dot)cx(dot)zhang(at)hotmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Zhaoxun Yan 2023-09-27 09:27:44 pg_rewind: ERROR: could not fetch remote file "global/pg_control": ERROR: permission denied
Previous Message Daniel Gustafsson 2023-09-27 09:13:32 Re: Bug of psql meta-command \sf & \sv