mcst-linux-kernel/patches-2024.06.26/postgresql13-13.5/0002_shlib_to_builtin.patch

243 lines
9.2 KiB
Diff

diff -uraN postgresql13-13.5/src/Makefile postgresql13-13.5_patch/src/Makefile
--- postgresql13-13.5/src/Makefile 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/Makefile 2023-01-19 19:22:37.814033891 +0300
@@ -18,7 +18,6 @@
timezone \
backend \
backend/utils/mb/conversion_procs \
- backend/snowball \
include \
interfaces \
backend/replication/libpqwalreceiver \
@@ -31,6 +30,9 @@
test/isolation \
test/perl
+# became builtin
+# backend/snowball \
+
ifeq ($(with_llvm), yes)
SUBDIRS += backend/jit/llvm
endif
diff -uraN postgresql13-13.5/src/backend/Makefile postgresql13-13.5_patch/src/backend/Makefile
--- postgresql13-13.5/src/backend/Makefile 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/backend/Makefile 2023-01-19 19:22:48.174294639 +0300
@@ -21,7 +21,9 @@
main nodes optimizer partitioning port postmaster \
regex replication rewrite \
statistics storage tcop tsearch utils $(top_builddir)/src/timezone \
- jit
+ jit \
+ snowball \
+ $(top_builddir)/src/pl/plpgsql
include $(srcdir)/common.mk
diff -uraN postgresql13-13.5/src/backend/postmaster/postmaster.c postgresql13-13.5_patch/src/backend/postmaster/postmaster.c
--- postgresql13-13.5/src/backend/postmaster/postmaster.c 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/backend/postmaster/postmaster.c 2023-01-19 19:22:48.682307425 +0300
@@ -1387,6 +1387,9 @@
errhint("Set the LC_ALL environment variable to a valid locale.")));
#endif
+ // init of builtin plpgsql
+ _PG_init_plpgsql();
+
/*
* Remember postmaster startup time
*/
diff -uraN postgresql13-13.5/src/backend/snowball/Makefile postgresql13-13.5_patch/src/backend/snowball/Makefile
--- postgresql13-13.5/src/backend/snowball/Makefile 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/backend/snowball/Makefile 2023-01-19 19:22:48.354299169 +0300
@@ -101,8 +101,12 @@
NAME := dict_snowball
rpath =
+# generate objfiles.txt
+include $(top_srcdir)/src/backend/common.mk
+
all: all-shared-lib $(SQLSCRIPT)
+include $(top_srcdir)/src/backend/common.mk
include $(top_srcdir)/src/Makefile.shlib
$(SQLSCRIPT): Makefile snowball_func.sql.in snowball.sql.in
diff -uraN postgresql13-13.5/src/backend/snowball/dict_snowball.c postgresql13-13.5_patch/src/backend/snowball/dict_snowball.c
--- postgresql13-13.5/src/backend/snowball/dict_snowball.c 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/backend/snowball/dict_snowball.c 2023-01-19 19:22:48.346298968 +0300
@@ -67,7 +67,7 @@
#include "snowball/libstemmer/stem_UTF_8_tamil.h"
#include "snowball/libstemmer/stem_UTF_8_turkish.h"
-PG_MODULE_MAGIC;
+//PG_MODULE_MAGIC;
PG_FUNCTION_INFO_V1(dsnowball_init);
diff -uraN postgresql13-13.5/src/backend/snowball/snowball_func.sql.in postgresql13-13.5_patch/src/backend/snowball/snowball_func.sql.in
--- postgresql13-13.5/src/backend/snowball/snowball_func.sql.in 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/backend/snowball/snowball_func.sql.in 2023-01-19 19:22:48.350299069 +0300
@@ -19,14 +19,6 @@
SET search_path = pg_catalog;
-CREATE FUNCTION dsnowball_init(INTERNAL)
- RETURNS INTERNAL AS '$libdir/dict_snowball', 'dsnowball_init'
-LANGUAGE C STRICT;
-
-CREATE FUNCTION dsnowball_lexize(INTERNAL, INTERNAL, INTERNAL, INTERNAL)
- RETURNS INTERNAL AS '$libdir/dict_snowball', 'dsnowball_lexize'
-LANGUAGE C STRICT;
-
CREATE TEXT SEARCH TEMPLATE snowball
(INIT = dsnowball_init,
LEXIZE = dsnowball_lexize);
diff -uraN postgresql13-13.5/src/pl/Makefile postgresql13-13.5_patch/src/pl/Makefile
--- postgresql13-13.5/src/pl/Makefile 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/pl/Makefile 2023-01-19 19:22:50.710358467 +0300
@@ -12,7 +12,8 @@
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
-SUBDIRS = plpgsql
+# became builtin
+#SUBDIRS = plpgsql
ifeq ($(with_perl), yes)
SUBDIRS += plperl
diff -uraN postgresql13-13.5/src/pl/plpgsql/Makefile postgresql13-13.5_patch/src/pl/plpgsql/Makefile
--- postgresql13-13.5/src/pl/plpgsql/Makefile 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/pl/plpgsql/Makefile 2023-01-19 19:22:50.714358567 +0300
@@ -14,4 +14,7 @@
SUBDIRS = src
-$(recurse)
+# generate objfiles.txt
+include $(top_srcdir)/src/backend/common.mk
+
+#$(recurse)
diff -uraN postgresql13-13.5/src/pl/plpgsql/src/Makefile postgresql13-13.5_patch/src/pl/plpgsql/src/Makefile
--- postgresql13-13.5/src/pl/plpgsql/src/Makefile 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/pl/plpgsql/src/Makefile 2023-01-19 19:22:50.854362092 +0300
@@ -28,6 +28,9 @@
pl_handler.o \
pl_scanner.o
+# generate objfiles.txt
+include $(top_srcdir)/src/backend/common.mk
+
DATA = plpgsql.control plpgsql--1.0.sql
REGRESS_OPTS = --dbname=$(PL_TESTDB)
@@ -51,7 +54,6 @@
# Shared library stuff
include $(top_srcdir)/src/Makefile.shlib
-
install: all install-lib install-data install-headers
installdirs: installdirs-lib
diff -uraN postgresql13-13.5/src/pl/plpgsql/src/plpgsql--1.0.sql postgresql13-13.5_patch/src/pl/plpgsql/src/plpgsql--1.0.sql
--- postgresql13-13.5/src/pl/plpgsql/src/plpgsql--1.0.sql 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/pl/plpgsql/src/plpgsql--1.0.sql 2023-01-19 19:22:51.094368132 +0300
@@ -1,14 +1,5 @@
/* src/pl/plpgsql/src/plpgsql--1.0.sql */
-CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
- LANGUAGE c AS 'MODULE_PATHNAME';
-
-CREATE FUNCTION plpgsql_inline_handler(internal) RETURNS void
- STRICT LANGUAGE c AS 'MODULE_PATHNAME';
-
-CREATE FUNCTION plpgsql_validator(oid) RETURNS void
- STRICT LANGUAGE c AS 'MODULE_PATHNAME';
-
CREATE TRUSTED LANGUAGE plpgsql
HANDLER plpgsql_call_handler
INLINE plpgsql_inline_handler
diff -uraN postgresql13-13.5/src/pl/plpgsql/src/pl_handler.c postgresql13-13.5_patch/src/pl/plpgsql/src/pl_handler.c
--- postgresql13-13.5/src/pl/plpgsql/src/pl_handler.c 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/pl/plpgsql/src/pl_handler.c 2023-01-19 19:22:50.830361487 +0300
@@ -31,7 +31,7 @@
static void plpgsql_extra_warnings_assign_hook(const char *newvalue, void *extra);
static void plpgsql_extra_errors_assign_hook(const char *newvalue, void *extra);
-PG_MODULE_MAGIC;
+//PG_MODULE_MAGIC;
/* Custom GUC variable */
static const struct config_enum_entry variable_conflict_options[] = {
@@ -142,12 +142,12 @@
* DO NOT make this static nor change its name!
*/
void
-_PG_init(void)
+_PG_init_plpgsql(void)
{
/* Be sure we do initialization only once (should be redundant now) */
- static bool inited = false;
+ static bool inited_plpgsql = false;
- if (inited)
+ if (inited_plpgsql)
return;
pg_bindtextdomain(TEXTDOMAIN);
@@ -206,7 +206,7 @@
/* Set up a rendezvous point with optional instrumentation plugin */
plpgsql_plugin_ptr = (PLpgSQL_plugin **) find_rendezvous_variable("PLpgSQL_plugin");
- inited = true;
+ inited_plpgsql = true;
}
/* ----------
diff -uraN postgresql13-13.5/src/include/catalog/pg_proc.dat postgresql13-13.5_patch/src/include/catalog/pg_proc.dat
--- postgresql13-13.5/src/include/catalog/pg_proc.dat 2021-11-09 01:00:24.000000000 +0300
+++ postgresql13-13.5_patch/src/include/catalog/pg_proc.dat 2023-01-19 19:22:38.418049093 +0300
@@ -10937,4 +10937,43 @@
proname => 'is_normalized', prorettype => 'bool', proargtypes => 'text text',
prosrc => 'unicode_is_normalized' },
+# Functions from shlibs became builtin for "-fwhole" optimization
+# Is need parameter proisstrict => 'f' ?
+################################################
+### src/backend/snowball/snowball_create.sql ###
+################################################
+# CREATE FUNCTION dsnowball_init(INTERNAL)
+# RETURNS INTERNAL AS '$libdir/dict_snowball', 'dsnowball_init'
+# LANGUAGE C STRICT;
+{ oid => '8000', descr => 'dsnowball init',
+ proname => 'dsnowball_init', prorettype => 'internal',
+ proargtypes => 'internal', prosrc => 'dsnowball_init' },
+
+# CREATE FUNCTION dsnowball_lexize(INTERNAL, INTERNAL, INTERNAL, INTERNAL)
+# RETURNS INTERNAL AS '$libdir/dict_snowball', 'dsnowball_lexize'
+# LANGUAGE C STRICT;
+{ oid => '8001', descr => 'dsnowball lexize',
+ proname => 'dsnowball_lexize', prorettype => 'internal',
+ proargtypes => 'internal internal internal internal', prosrc => 'dsnowball_lexize' },
+
+###########################################
+### src/pl/plpgsql/src/plpgsql--1.0.sql ###
+###########################################
+# CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
+# LANGUAGE c AS 'MODULE_PATHNAME';
+{ oid => '8002', descr => 'plpgsql call handler',
+ proname => 'plpgsql_call_handler', prorettype => 'language_handler',
+ proargtypes => '', prosrc => 'plpgsql_call_handler' },
+
+# CREATE FUNCTION plpgsql_inline_handler(internal) RETURNS void
+# STRICT LANGUAGE c AS 'MODULE_PATHNAME';
+{ oid => '8003', descr => 'plpgsql inline handler',
+ proname => 'plpgsql_inline_handler', prorettype => 'void',
+ proargtypes => 'internal', prosrc => 'plpgsql_inline_handler' },
+
+# CREATE FUNCTION plpgsql_validator(oid) RETURNS void
+# STRICT LANGUAGE c AS 'MODULE_PATHNAME';
+{ oid => '8004', descr => 'plpgsql validator',
+ proname => 'plpgsql_validator', prorettype => 'void',
+ proargtypes => 'oid', prosrc => 'plpgsql_validator' },
]