On 18.09.24 10:23, jian he wrote:
On Wed, Sep 18, 2024 at 4:09 PM Peter Eisentraut <pe...@eisentraut.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.
I think this change is not technically wrong, but I think it doesn't
make a difference either way, so I don't see why we should make a change
here.
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,