Re: information_schema.view attgenerated

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: information_schema.view attgenerated
Date: 2024-09-18 08:23:52
Message-ID: CACJufxGZUQDN=QWMooABT9m+DwyHrRAQMz=46pp4X+yY+CREeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 18, 2024 at 4:09 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> >
> > i guess, it will have some minor speed up, also more accurate.
>
> I'm having a hard time interpreting this report. Could you be more
> clear about what is the existing code, and what is the code you are
> proposing as new.?
>

sorry for confusion. The changes I propose, also attached.

diff --git a/src/backend/catalog/information_schema.sql
b/src/backend/catalog/information_schema.sql
index c4145131ce..ff8b9305e4 100644
--- a/src/backend/catalog/information_schema.sql
+++ b/src/backend/catalog/information_schema.sql
@@ -688,7 +688,7 @@ CREATE VIEW columns AS
CAST(c.relname AS sql_identifier) AS table_name,
CAST(a.attname AS sql_identifier) AS column_name,
CAST(a.attnum AS cardinal_number) AS ordinal_position,
- CAST(CASE WHEN a.attgenerated = '' THEN
pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS
column_default,
+ CAST(CASE WHEN a.attgenerated = '' AND a.atthasdef THEN
pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS
column_default,
CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND
t.typnotnull) THEN 'NO' ELSE 'YES' END
AS yes_or_no)
AS is_nullable,
@@ -777,8 +777,8 @@ CREATE VIEW columns AS
CAST(seq.seqmin AS character_data) AS identity_minimum,
CAST(CASE WHEN seq.seqcycle THEN 'YES' ELSE 'NO' END AS
yes_or_no) AS identity_cycle,

- CAST(CASE WHEN a.attgenerated <> '' THEN 'ALWAYS' ELSE
'NEVER' END AS character_data) AS is_generated,
- CAST(CASE WHEN a.attgenerated <> '' THEN
pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS
generation_expression,
+ CAST(CASE WHEN a.attgenerated <> '' AND a.atthasdef THEN
'ALWAYS' ELSE 'NEVER' END AS character_data) AS is_generated,
+ CAST(CASE WHEN a.attgenerated <> '' AND a.atthasdef THEN
pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS
generation_expression,

Attachment Content-Type Size
temp.diff text/x-patch 1.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Florents Tselai 2024-09-18 08:39:25 Re: [PATCH] WIP: replace method for jsonpath
Previous Message Peter Eisentraut 2024-09-18 08:23:22 Re: [PATCH] WIP: replace method for jsonpath