nixpkgs/pkgs/servers/sql/postgresql/patches/empty-pg-config-view-15+.patch
Wolfgang Walther 435f51c37f
postgresql: split dev output
This splits a dev output to make the default output not depend on any
build dependencies anymore. This also avoids removing references from
pgxs' Makefile this way, which should, at least theoretically, be good
to build extensions via pgxs, making sure they use the same tooling.

ecpg is the "embedded SQL C preprocessor", which is certainly a dev
tool.

Most important, for closure size anyway, is to move pg_config to the dev
output, since it retains paths to all the other outputs.

The only thing with references to the dev output remaining is then the
postgres binary itself. It contains all the output paths, because it
shows those in the pg_config system view. There is no other way than
to nuke those references to avoid circular dependencies between outputs
- and blowing up closure size again.
2024-08-23 21:37:49 +02:00

55 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;