Skip to content

Commit 257e451

Browse files
committed
Variant with manual filtering of composite types
1 parent 6a4bfbc commit 257e451

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

crates/configuration/src/version3/version3.sql

+32-29
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
-- When debugging in 'psql', uncomment the lines below to be able to run the
88
-- query with arguments set.
99

10-
-- DEALLOCATE ALL; -- Or use 'DEALLOCATE configuration' between reloads
11-
-- PREPARE configuration(varchar[], varchar[], varchar[], jsonb, varchar[]) AS
10+
DEALLOCATE ALL; -- Or use 'DEALLOCATE configuration' between reloads
11+
PREPARE configuration(varchar[], varchar[], varchar[], jsonb, varchar[], varchar[]) AS
1212

1313
WITH
1414
-- The overall structure of this query is a CTE (i.e. 'WITH .. SELECT')
@@ -229,6 +229,8 @@ WITH
229229
exclusively_composite_type_ids AS
230230
(
231231
SELECT relation_id FROM composite_types
232+
WHERE
233+
NOT (type_name = ANY ($6))
232234
EXCEPT
233235
SELECT relation_id FROM relations
234236
)
@@ -1172,10 +1174,10 @@ WITH
11721174
c.constraint_type = 'f' -- For foreign-key constraints
11731175
)
11741176
SELECT
1175-
coalesce(tables.result, '{}'::jsonb) AS "Tables",
1176-
coalesce(aggregate_functions.result, '{}'::jsonb) AS "AggregateFunctions",
1177-
coalesce(comparison_functions.result, '{}'::jsonb) AS "ComparisonFunctions",
1178-
coalesce(composite_types_json.result, '{}'::jsonb) AS "CompositeTypes"
1177+
jsonb_pretty(coalesce(tables.result, '{}'::jsonb)) AS "Tables",
1178+
jsonb_pretty(coalesce(aggregate_functions.result, '{}'::jsonb)) AS "AggregateFunctions",
1179+
jsonb_pretty(coalesce(comparison_functions.result, '{}'::jsonb)) AS "ComparisonFunctions",
1180+
jsonb_pretty(coalesce(composite_types_json.result, '{}'::jsonb)) AS "CompositeTypes"
11791181
FROM
11801182
(
11811183
SELECT
@@ -1490,26 +1492,27 @@ FROM
14901492

14911493
-- Uncomment the following lines to just run the configuration query with reasonable default arguments
14921494
--
1493-
-- EXECUTE configuration(
1494-
-- '{"information_schema", "tiger", "pg_catalog", "topology"}'::varchar[],
1495-
-- '{"public"}'::varchar[],
1496-
-- '{"public", "pg_catalog", "tiger"}'::varchar[],
1497-
-- '[
1498-
-- {"operatorName": "=", "exposedName": "_eq", "operatorKind": "equal"},
1499-
-- {"operatorName": "!=", "exposedName": "_neq", "operatorKind": "custom"},
1500-
-- {"operatorName": "<>", "exposedName": "_neq", "operatorKind": "custom"},
1501-
-- {"operatorName": "<=", "exposedName": "_lte", "operatorKind": "custom"},
1502-
-- {"operatorName": ">", "exposedName": "_gt", "operatorKind": "custom"},
1503-
-- {"operatorName": ">=", "exposedName": "_gte", "operatorKind": "custom"},
1504-
-- {"operatorName": "<", "exposedName": "_lt", "operatorKind": "custom"},
1505-
-- {"operatorName": "~~", "exposedName": "_like", "operatorKind": "custom"},
1506-
-- {"operatorName": "!~~", "exposedName": "_nlike", "operatorKind": "custom"},
1507-
-- {"operatorName": "~~*", "exposedName": "_ilike", "operatorKind": "custom"},
1508-
-- {"operatorName": "!~~*", "exposedName": "_nilike", "operatorKind": "custom"},
1509-
-- {"operatorName": "~", "exposedName": "_regex", "operatorKind": "custom"},
1510-
-- {"operatorName": "!~", "exposedName": "_nregex", "operatorKind": "custom"},
1511-
-- {"operatorName": "~*", "exposedName": "_iregex", "operatorKind": "custom"},
1512-
-- {"operatorName": "!~*", "exposedName": "_niregex", "operatorKind": "custom"}
1513-
-- ]'::jsonb,
1514-
-- '{box_above,box_below}'::varchar[]
1515-
-- );
1495+
EXECUTE configuration(
1496+
'{"information_schema", "tiger", "pg_catalog", "topology"}'::varchar[],
1497+
'{"public"}'::varchar[],
1498+
'{"public", "pg_catalog", "tiger"}'::varchar[],
1499+
'[
1500+
{"operatorName": "=", "exposedName": "_eq", "operatorKind": "equal"},
1501+
{"operatorName": "!=", "exposedName": "_neq", "operatorKind": "custom"},
1502+
{"operatorName": "<>", "exposedName": "_neq", "operatorKind": "custom"},
1503+
{"operatorName": "<=", "exposedName": "_lte", "operatorKind": "custom"},
1504+
{"operatorName": ">", "exposedName": "_gt", "operatorKind": "custom"},
1505+
{"operatorName": ">=", "exposedName": "_gte", "operatorKind": "custom"},
1506+
{"operatorName": "<", "exposedName": "_lt", "operatorKind": "custom"},
1507+
{"operatorName": "~~", "exposedName": "_like", "operatorKind": "custom"},
1508+
{"operatorName": "!~~", "exposedName": "_nlike", "operatorKind": "custom"},
1509+
{"operatorName": "~~*", "exposedName": "_ilike", "operatorKind": "custom"},
1510+
{"operatorName": "!~~*", "exposedName": "_nilike", "operatorKind": "custom"},
1511+
{"operatorName": "~", "exposedName": "_regex", "operatorKind": "custom"},
1512+
{"operatorName": "!~", "exposedName": "_nregex", "operatorKind": "custom"},
1513+
{"operatorName": "~*", "exposedName": "_iregex", "operatorKind": "custom"},
1514+
{"operatorName": "!~*", "exposedName": "_niregex", "operatorKind": "custom"}
1515+
]'::jsonb,
1516+
'{box_above,box_below}'::varchar[],
1517+
'{woop,replication_slot_info,split_copy_info,split_shard_info,geometry_dump,valid_detail,norm_addy}'::varchar[]
1518+
);

0 commit comments

Comments
 (0)