From: Jet Zhang <jet.cx.zhang@hotmail.com>
To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Bug of psql meta-command \sf & \sv
Date: Wed, 27 Sep 2023 09:06:45 +0000
Message-ID: <TY3P286MB259429FE5F1A31B3D7A2ABD2D5C2A@TY3P286MB2594.JPNP286.PROD.OUTLOOK.COM> (raw)
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.png@01D80E0F.FAC36F80]
章晨曦 Jet C.X. ZHANG
18657181679
易景科技 http://www.halodbtech.com
浙江省杭州市滨江区长河街道建业路511号华创大厦5层505
Attachments:D34C3C37F8064725932B6933724325A3[2752723].png (image/png, 9.4K) downloadview image
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: jet.cx.zhang@hotmail.com
Subject: Re: Bug of psql meta-command \sf & \sv
In-Reply-To: <TY3P286MB259429FE5F1A31B3D7A2ABD2D5C2A@TY3P286MB2594.JPNP286.PROD.OUTLOOK.COM>
References: <TY3P286MB259429FE5F1A31B3D7A2ABD2D5C2A@TY3P286MB2594.JPNP286.PROD.OUTLOOK.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