Bug of psql meta-command \sf & \sv

From: Jet Zhang <jet(dot)cx(dot)zhang(at)hotmail(dot)com>
To: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Bug of psql meta-command \sf & \sv
Date: 2023-09-27 09:06:45
Message-ID: TY3P286MB259429FE5F1A31B3D7A2ABD2D5C2A@TY3P286MB2594.JPNP286.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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.

And the same error also exists on \sv command:
postgres=# CREATE VIEW v_test AS SELECT * FROM pg_class;
postgres=# \sv v_test
CREATE OR REPLACE VIEW public.v_test AS
SELECT pg_class.oid,
pg_class.relname,
pg_class.relnamespace,
pg_class.reltype,
pg_class.reloftype,
pg_class.relowner,
pg_class.relam,
pg_class.relfilenode,
pg_class.reltablespace,
pg_class.relpages,
pg_class.reltuples,
pg_class.relallvisible,
pg_class.reltoastrelid,
pg_class.relhasindex,
pg_class.relisshared,
pg_class.relpersistence,
pg_class.relkind,
pg_class.relnatts,
pg_class.relchecks,
pg_class.relhasrules,
pg_class.relhastriggers,
pg_class.relhassubclass,
pg_class.relrowsecurity,
pg_class.relforcerowsecurity,
pg_class.relispopulated,
pg_class.relreplident,
pg_class.relispartition,
pg_class.relrewrite,
pg_class.relfrozenxid,
pg_class.relminmxid,
pg_class.relacl,
pg_class.reloptions,
pg_class.relpartbound
FROM pg_class
postgres=# \sv v_test;
2023-09-27 16:56:10.086 CST [3460153] ERROR: relation "v_test;" does not exist at character 8
2023-09-27 16:56:10.086 CST [3460153] STATEMENT: SELECT 'v_test;'::pg_catalog.regclass::pg_catalog.oid
ERROR: relation "v_test;" does not exist

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

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniel Gustafsson 2023-09-27 09:13:32 Re: Bug of psql meta-command \sf & \sv
Previous Message Daniel Gustafsson 2023-09-27 09:06:17 Re: PG_DUMPALL not executable within docker container