depot/pkgs/servers/sql/postgresql/patches/empty-pg-config-view-15+.patch
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

54 lines
1.8 KiB
Diff

Empty the pg_config system information view. This view keeps references to
several -dev outputs, which we want to avoid to keep closure size down.
The alternative to this patch would be to nuke references across the board,
but this will also affect the output of the pg_config utility. By emptying
the view only, we keep the pg_config binary intact. It resides in the -dev
output, so it's fine to have all those references there.
---
--- a/src/backend/utils/misc/pg_config.c
+++ b/src/backend/utils/misc/pg_config.c
@@ -32,20 +32,5 @@ pg_config(PG_FUNCTION_ARGS)
/* initialize our tuplestore */
InitMaterializedSRF(fcinfo, 0);
- configdata = get_configdata(my_exec_path, &configdata_len);
- for (i = 0; i < configdata_len; i++)
- {
- Datum values[2];
- bool nulls[2];
-
- memset(values, 0, sizeof(values));
- memset(nulls, 0, sizeof(nulls));
-
- values[0] = CStringGetTextDatum(configdata[i].name);
- values[1] = CStringGetTextDatum(configdata[i].setting);
-
- tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, values, nulls);
- }
-
return (Datum) 0;
}
--- a/src/test/regress/expected/sysviews.out
+++ b/src/test/regress/expected/sysviews.out
@@ -29,7 +29,7 @@ select name, ident, parent, level, total_bytes >= free_bytes
(1 row)
-- At introduction, pg_config had 23 entries; it may grow
-select count(*) > 20 as ok from pg_config;
+select count(*) = 0 as ok from pg_config;
ok
----
t
--- a/src/test/regress/sql/sysviews.sql
+++ b/src/test/regress/sql/sysviews.sql
@@ -18,7 +18,7 @@ select name, ident, parent, level, total_bytes >= free_bytes
from pg_backend_memory_contexts where level = 0;
-- At introduction, pg_config had 23 entries; it may grow
-select count(*) > 20 as ok from pg_config;
+select count(*) = 0 as ok from pg_config;
-- We expect no cursors in this test; see also portals.sql
select count(*) = 0 as ok from pg_cursors;