Skip to content

Commit c246eb5

Browse files
committed
Make use of LATERAL in information_schema.sequences view.
It said "XXX: The following could be improved if we had LATERAL" ... so let's do that. No catversion bump since either version of the view works fine.
1 parent 084a29c commit c246eb5

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/backend/catalog/information_schema.sql

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,13 +1521,12 @@ CREATE VIEW sequences AS
15211521
CAST(64 AS cardinal_number) AS numeric_precision,
15221522
CAST(2 AS cardinal_number) AS numeric_precision_radix,
15231523
CAST(0 AS cardinal_number) AS numeric_scale,
1524-
-- XXX: The following could be improved if we had LATERAL.
1525-
CAST((pg_sequence_parameters(c.oid)).start_value AS character_data) AS start_value,
1526-
CAST((pg_sequence_parameters(c.oid)).minimum_value AS character_data) AS minimum_value,
1527-
CAST((pg_sequence_parameters(c.oid)).maximum_value AS character_data) AS maximum_value,
1528-
CAST((pg_sequence_parameters(c.oid)).increment AS character_data) AS increment,
1529-
CAST(CASE WHEN (pg_sequence_parameters(c.oid)).cycle_option THEN 'YES' ELSE 'NO' END AS yes_or_no) AS cycle_option
1530-
FROM pg_namespace nc, pg_class c
1524+
CAST(p.start_value AS character_data) AS start_value,
1525+
CAST(p.minimum_value AS character_data) AS minimum_value,
1526+
CAST(p.maximum_value AS character_data) AS maximum_value,
1527+
CAST(p.increment AS character_data) AS increment,
1528+
CAST(CASE WHEN p.cycle_option THEN 'YES' ELSE 'NO' END AS yes_or_no) AS cycle_option
1529+
FROM pg_namespace nc, pg_class c, LATERAL pg_sequence_parameters(c.oid) p
15311530
WHERE c.relnamespace = nc.oid
15321531
AND c.relkind = 'S'
15331532
AND (NOT pg_is_other_temp_schema(nc.oid))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy