From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: albin.hermange@gmail.com
Subject: BUG #17771: add a "status" column to the pg_rules system view
Date: Sun, 05 Feb 2023 16:02:58 +0000
Message-ID: <17771-818ce255fdbaef2c@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17771
Logged by: Albin Hermange
Email address: albin.hermange@gmail.com
PostgreSQL version: 15.1
Operating system: all OS
Description:
hi,
I noticed that the pg_rules system view (all PG versions) does not include a
"status" field (like in pg_trigger with tgenabled column)
the official view (from 15.1 sources) is :
CREATE VIEW pg_rules AS
SELECT
N.nspname AS schemaname,
C.relname AS tablename,
R.rulename AS rulename,
pg_get_ruledef(R.oid) AS definition
FROM (pg_rewrite R JOIN pg_class C ON (C.oid = R.ev_class))
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE R.rulename != '_RETURN';
i propose to add a new field "rule_enabled" to get (easilly and officially)
the rule status to all PG version
CREATE VIEW pg_rules AS
SELECT
N.nspname AS schemaname,
C.relname AS tablename,
R.rulename AS rulename,
R.ev_enabled as rule_enabled,
pg_get_ruledef(R.oid) AS definition
FROM (pg_rewrite R JOIN pg_class C ON (C.oid = R.ev_class))
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE R.rulename != '_RETURN';
What do u think about that ?
Thx
Albin
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: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, albin.hermange@gmail.com
Subject: Re: BUG #17771: add a "status" column to the pg_rules system view
In-Reply-To: <17771-818ce255fdbaef2c@postgresql.org>
* 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