This is an automated email from the ASF dual-hosted git repository.

chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/cbdb-postgres-merge by this 
push:
     new 52468b543d7 Enable plpgsql
52468b543d7 is described below

commit 52468b543d7665c01fc371a9c48adcfc6ab60a6e
Author: Jinbao Chen <[email protected]>
AuthorDate: Thu Oct 16 09:35:26 2025 +0800

    Enable plpgsql
---
 src/Makefile                                   |  3 +-
 src/pl/plperl/GNUmakefile                      | 12 +---
 src/pl/plperl/nls.mk                           |  4 --
 src/pl/plperl/plperl.h                         |  3 -
 src/pl/plperl/plperl_system.h                  |  4 --
 src/pl/plpgsql/src/expected/plpgsql_record.out | 15 -----
 src/pl/plpgsql/src/expected/plpgsql_simple.out | 43 ------------
 src/pl/plpgsql/src/nls.mk                      |  5 --
 src/pl/plpgsql/src/pl_exec.c                   |  4 --
 src/pl/plpgsql/src/plpgsql.h                   |  5 --
 src/pl/plpgsql/src/sql/plpgsql_record.sql      |  5 --
 src/pl/plpgsql/src/sql/plpgsql_simple.sql      | 37 -----------
 src/pl/plpython/Makefile                       |  9 ---
 src/pl/plpython/plpy_exec.c                    |  4 --
 src/pl/plpython/plpython_system.h              | 91 --------------------------
 src/pl/tcl/nls.mk                              |  4 --
 16 files changed, 4 insertions(+), 244 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index b0b699420df..d79274d3dea 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -45,7 +45,8 @@ SUBDIRS = \
        interfaces \
        backend/replication/pgoutput \
        fe_utils \
-       bin
+       bin \
+       pl
 
 ifeq ($(with_llvm), yes)
 SUBDIRS += backend/jit/llvm
diff --git a/src/pl/plperl/GNUmakefile b/src/pl/plperl/GNUmakefile
index e3583f86c8e..a57fd2c36b1 100644
--- a/src/pl/plperl/GNUmakefile
+++ b/src/pl/plperl/GNUmakefile
@@ -55,17 +55,13 @@ endif # win32
 
 SHLIB_LINK = $(perl_embed_ldflags)
 
-<<<<<<< HEAD
-REGRESS_OPTS = --dbname=$(PL_TESTDB)
-REGRESS_OPTS += --init-file=init_file
-=======
 # see 
https://www.postgresql.org/message-id/flat/8c4fcb72-2574-ff7c-4c25-1f032d4a2a57%40enterprisedb.com
 ifeq ($(PORTNAME), cygwin)
 SHLIB_LINK += -Wl,--export-all-symbols
 endif
 
-REGRESS_OPTS = --dbname=$(PL_TESTDB) --dlpath=$(top_builddir)/src/test/regress
->>>>>>> REL_16_9
+REGRESS_OPTS = --dbname=$(PL_TESTDB)
+REGRESS_OPTS += --init-file=init_file
 REGRESS = plperl_setup plperl plperl_lc plperl_trigger plperl_shared \
        plperl_elog plperl_util plperl_init plperlu plperl_array \
        plperl_call plperl_transaction plperl_env
@@ -118,11 +114,7 @@ uninstall: uninstall-lib uninstall-data
 
 install-data: installdirs
        $(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) 
'$(DESTDIR)$(datadir)/extension/'
-<<<<<<< HEAD
-       $(INSTALL_DATA) $(srcdir)/plperl.h $(srcdir)/plperl_system.h 
$(srcdir)/ppport.h $(srcdir)/plperl_helpers.h '$(DESTDIR)$(includedir_server)'
-=======
        $(INSTALL_DATA) $(srcdir)/plperl.h $(srcdir)/plperl_system.h 
$(srcdir)/ppport.h '$(DESTDIR)$(includedir_server)'
->>>>>>> REL_16_9
 
 uninstall-data:
        rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA)))
diff --git a/src/pl/plperl/nls.mk b/src/pl/plperl/nls.mk
index 58ab04177f2..8c41bfac7a9 100644
--- a/src/pl/plperl/nls.mk
+++ b/src/pl/plperl/nls.mk
@@ -1,9 +1,5 @@
 # src/pl/plperl/nls.mk
 CATALOG_NAME     = plperl
-<<<<<<< HEAD
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl pt_BR ro ru sv tr uk vi zh_CN
-=======
->>>>>>> REL_16_9
 GETTEXT_FILES    = plperl.c SPI.c
 GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS)
 GETTEXT_FLAGS    = $(BACKEND_COMMON_GETTEXT_FLAGS)
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index d52aefe8f80..7f338084a99 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -15,12 +15,9 @@
 #ifndef PL_PERL_H
 #define PL_PERL_H
 
-<<<<<<< HEAD
-=======
 /* defines free() by way of system headers, so must be included before perl.h 
*/
 #include "mb/pg_wchar.h"
 
->>>>>>> REL_16_9
 /*
  * Pull in Perl headers via a wrapper header, to control the scope of
  * the system_header pragma therein.
diff --git a/src/pl/plperl/plperl_system.h b/src/pl/plperl/plperl_system.h
index ec67acda12d..61550db2a5d 100644
--- a/src/pl/plperl/plperl_system.h
+++ b/src/pl/plperl/plperl_system.h
@@ -109,10 +109,6 @@
 #undef fstat
 #undef kill
 #undef listen
-<<<<<<< HEAD
-=======
-#undef lseek
->>>>>>> REL_16_9
 #undef lstat
 #undef mkdir
 #undef open
diff --git a/src/pl/plpgsql/src/expected/plpgsql_record.out 
b/src/pl/plpgsql/src/expected/plpgsql_record.out
index 25c4104814b..b5f0e4b9ff1 100644
--- a/src/pl/plpgsql/src/expected/plpgsql_record.out
+++ b/src/pl/plpgsql/src/expected/plpgsql_record.out
@@ -437,21 +437,6 @@ select getf1(row(1,2));
      1
 (1 row)
 
-<<<<<<< HEAD
-=======
-select getf1(row(1,2)::two_int4s);
- getf1 
--------
-     1
-(1 row)
-
-select getf1(row('foo',123,456)::more_int4s);
- getf1 
--------
-   123
-(1 row)
-
->>>>>>> REL_16_9
 -- the context stack is different when debug_discard_caches
 -- is set, so suppress context output
 \set SHOW_CONTEXT never
diff --git a/src/pl/plpgsql/src/expected/plpgsql_simple.out 
b/src/pl/plpgsql/src/expected/plpgsql_simple.out
index 62fc116783d..e1f5d670fbe 100644
--- a/src/pl/plpgsql/src/expected/plpgsql_simple.out
+++ b/src/pl/plpgsql/src/expected/plpgsql_simple.out
@@ -89,46 +89,3 @@ select simplecaller();
             4
 (1 row)
 
-<<<<<<< HEAD
-=======
--- Check case where called function changes from non-SRF to SRF (bug #18497)
-create or replace function simplecaller() returns int language plpgsql
-as $$
-declare x int;
-begin
-  x := simplesql();
-  return x;
-end$$;
-select simplecaller();
- simplecaller 
---------------
-            4
-(1 row)
-
-drop function simplesql();
-create function simplesql() returns setof int language sql
-as $$select 22 + 22$$;
-select simplecaller();
- simplecaller 
---------------
-           44
-(1 row)
-
-select simplecaller();
- simplecaller 
---------------
-           44
-(1 row)
-
--- Check handling of simple expression in a scrollable cursor (bug #18859)
-do $$
-declare
- p_CurData refcursor;
- val int;
-begin
- open p_CurData scroll for select 42;
- fetch p_CurData into val;
- raise notice 'val = %', val;
-end; $$;
-NOTICE:  val = 42
->>>>>>> REL_16_9
diff --git a/src/pl/plpgsql/src/nls.mk b/src/pl/plpgsql/src/nls.mk
index 344d4fd00db..e1d3bde6c37 100644
--- a/src/pl/plpgsql/src/nls.mk
+++ b/src/pl/plpgsql/src/nls.mk
@@ -1,15 +1,10 @@
 # src/pl/plpgsql/src/nls.mk
 CATALOG_NAME     = plpgsql
-<<<<<<< HEAD
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl pt_BR ru sv tr uk vi zh_CN
-GETTEXT_FILES    = pl_comp.c pl_exec.c pl_gram.c pl_funcs.c pl_handler.c 
pl_scanner.c
-=======
 GETTEXT_FILES    = pl_comp.c \
                    pl_exec.c \
                    pl_gram.c \
                    pl_funcs.c \
                    pl_handler.c \
                    pl_scanner.c
->>>>>>> REL_16_9
 GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS) yyerror plpgsql_yyerror
 GETTEXT_FLAGS    = $(BACKEND_COMMON_GETTEXT_FLAGS)
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index fe01f5126ee..78a57328852 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -4319,11 +4319,7 @@ exec_stmt_execsql(PLpgSQL_execstate *estate,
                case SPI_OK_INSERT_RETURNING:
                case SPI_OK_UPDATE_RETURNING:
                case SPI_OK_DELETE_RETURNING:
-<<<<<<< HEAD
-=======
                case SPI_OK_MERGE:
-                       Assert(stmt->mod_stmt);
->>>>>>> REL_16_9
                        exec_set_found(estate, (SPI_processed != 0));
                        break;
 
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index e7332f77310..84a1cca316d 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -896,15 +896,10 @@ typedef struct PLpgSQL_stmt_execsql
        int                     lineno;
        unsigned int stmtid;
        PLpgSQL_expr *sqlstmt;
-<<<<<<< HEAD
-       bool            mod_stmt;               /* is the stmt 
INSERT/UPDATE/DELETE? */
-=======
        bool            mod_stmt;               /* is the stmt 
INSERT/UPDATE/DELETE/MERGE? */
        bool            mod_stmt_set;   /* is mod_stmt valid yet? */
->>>>>>> REL_16_9
        bool            into;                   /* INTO supplied? */
        bool            strict;                 /* INTO STRICT flag */
-       bool            mod_stmt_set;   /* is mod_stmt valid yet? */
        PLpgSQL_variable *target;       /* INTO target (record or row) */
 } PLpgSQL_stmt_execsql;
 
diff --git a/src/pl/plpgsql/src/sql/plpgsql_record.sql 
b/src/pl/plpgsql/src/sql/plpgsql_record.sql
index f43599fa281..abed814aac4 100644
--- a/src/pl/plpgsql/src/sql/plpgsql_record.sql
+++ b/src/pl/plpgsql/src/sql/plpgsql_record.sql
@@ -267,11 +267,6 @@ create function getf1(x record) returns int language 
plpgsql as
 $$ begin return x.f1; end $$;
 select getf1(1);
 select getf1(row(1,2));
-<<<<<<< HEAD
-=======
-select getf1(row(1,2)::two_int4s);
-select getf1(row('foo',123,456)::more_int4s);
->>>>>>> REL_16_9
 -- the context stack is different when debug_discard_caches
 -- is set, so suppress context output
 \set SHOW_CONTEXT never
diff --git a/src/pl/plpgsql/src/sql/plpgsql_simple.sql 
b/src/pl/plpgsql/src/sql/plpgsql_simple.sql
index 485b700915d..57020d22d60 100644
--- a/src/pl/plpgsql/src/sql/plpgsql_simple.sql
+++ b/src/pl/plpgsql/src/sql/plpgsql_simple.sql
@@ -80,40 +80,3 @@ create or replace function simplesql() returns int language 
sql
 as $$select 2 + 2$$;
 
 select simplecaller();
-<<<<<<< HEAD
-=======
-
-
--- Check case where called function changes from non-SRF to SRF (bug #18497)
-
-create or replace function simplecaller() returns int language plpgsql
-as $$
-declare x int;
-begin
-  x := simplesql();
-  return x;
-end$$;
-
-select simplecaller();
-
-drop function simplesql();
-
-create function simplesql() returns setof int language sql
-as $$select 22 + 22$$;
-
-select simplecaller();
-
-select simplecaller();
-
--- Check handling of simple expression in a scrollable cursor (bug #18859)
-
-do $$
-declare
- p_CurData refcursor;
- val int;
-begin
- open p_CurData scroll for select 42;
- fetch p_CurData into val;
- raise notice 'val = %', val;
-end; $$;
->>>>>>> REL_16_9
diff --git a/src/pl/plpython/Makefile b/src/pl/plpython/Makefile
index b7577c2b367..28add80f141 100644
--- a/src/pl/plpython/Makefile
+++ b/src/pl/plpython/Makefile
@@ -78,16 +78,7 @@ endif # win32
 
 SHLIB_LINK = $(python_libspec) $(python_additional_libs) $(filter 
-lintl,$(LIBS))
 
-<<<<<<< HEAD
-REGRESS_OPTS = --dbname=$(PL_TESTDB) --init-file=$(srcdir)/init_file
-# Only load plpythonu with Python 2.  The test files themselves load
-# the versioned language plpython(2|3)u.
-ifeq ($(python_majorversion),2)
-REGRESS_OPTS += --load-extension=plpythonu
-endif
-=======
 REGRESS_OPTS = --dbname=$(PL_TESTDB)
->>>>>>> REL_16_9
 
 # FIXME: enable plpython_returns test. exec() functionality changed
 # between Python2 and Python3. plpython_returns test uses it
diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c
index a5d0cdacc92..e5fa9288e6f 100644
--- a/src/pl/plpython/plpy_exec.c
+++ b/src/pl/plpython/plpy_exec.c
@@ -745,11 +745,7 @@ PLy_trigger_build_args(FunctionCallInfo fcinfo, 
PLyProcedure *proc, HeapTuple *r
 
        PG_TRY();
        {
-<<<<<<< HEAD
-               pltname = PyString_FromString(tdata->tg_trigger->tgname);
-=======
                pltname = PLyUnicode_FromString(tdata->tg_trigger->tgname);
->>>>>>> REL_16_9
                PyDict_SetItemString(pltdata, "name", pltname);
                Py_DECREF(pltname);
 
diff --git a/src/pl/plpython/plpython_system.h 
b/src/pl/plpython/plpython_system.h
index f6aff0f75a5..9532789ae2f 100644
--- a/src/pl/plpython/plpython_system.h
+++ b/src/pl/plpython/plpython_system.h
@@ -28,32 +28,10 @@
 #endif
 
 /*
-<<<<<<< HEAD
- * Undefine some things that get (re)defined in the Python headers. They aren't
- * used by the PL/Python code, and all PostgreSQL headers should be included
- * earlier, so this should be pretty safe.
- */
-#undef _POSIX_C_SOURCE
-#undef _XOPEN_SOURCE
-
-/*
- * Sometimes python carefully scribbles on our *printf macros.
- * So we undefine them here and redefine them after it's done its dirty deed.
- */
-#undef vsnprintf
-#undef snprintf
-#undef vsprintf
-#undef sprintf
-#undef vfprintf
-#undef fprintf
-#undef vprintf
-#undef printf
-=======
  * Python versions <= 3.8 otherwise define a replacement, causing macro
  * redefinition warnings.
  */
 #define HAVE_SNPRINTF 1
->>>>>>> REL_16_9
 
 #if defined(_MSC_VER) && defined(_DEBUG)
 /* Python uses #pragma to bring in a non-default libpython on VC++ if
@@ -72,73 +50,4 @@
 #include <Python.h>
 #endif
 
-<<<<<<< HEAD
-/*
- * Python 2/3 strings/unicode/bytes handling.  Python 2 has strings
- * and unicode, Python 3 has strings, which are unicode on the C
- * level, and bytes.  The porting convention, which is similarly used
- * in Python 2.6, is that "Unicode" is always unicode, and "Bytes" are
- * bytes in Python 3 and strings in Python 2.  Since we keep
- * supporting Python 2 and its usual strings, we provide a
- * compatibility layer for Python 3 that when asked to convert a C
- * string to a Python string it converts the C string from the
- * PostgreSQL server encoding to a Python Unicode object.
- */
-#if PY_MAJOR_VERSION >= 3
-#define PyString_Check(x) 0
-#define PyString_AsString(x) PLyUnicode_AsString(x)
-#define PyString_FromString(x) PLyUnicode_FromString(x)
-#define PyString_FromStringAndSize(x, size) PLyUnicode_FromStringAndSize(x, 
size)
-#endif
-
-/*
- * Python 3 only has long.
- */
-#if PY_MAJOR_VERSION >= 3
-#define PyInt_FromLong(x) PyLong_FromLong(x)
-#define PyInt_AsLong(x) PyLong_AsLong(x)
-#endif
-
-/* Python 3 removed the Py_TPFLAGS_HAVE_ITER flag */
-#if PY_MAJOR_VERSION >= 3
-#define Py_TPFLAGS_HAVE_ITER 0
-#endif
-
-/* put back our *printf macros ... this must match src/include/port.h */
-#ifdef vsnprintf
-#undef vsnprintf
-#endif
-#ifdef snprintf
-#undef snprintf
-#endif
-#ifdef vsprintf
-#undef vsprintf
-#endif
-#ifdef sprintf
-#undef sprintf
-#endif
-#ifdef vfprintf
-#undef vfprintf
-#endif
-#ifdef fprintf
-#undef fprintf
-#endif
-#ifdef vprintf
-#undef vprintf
-#endif
-#ifdef printf
-#undef printf
-#endif
-
-#define vsnprintf              pg_vsnprintf
-#define snprintf               pg_snprintf
-#define vsprintf               pg_vsprintf
-#define sprintf                        pg_sprintf
-#define vfprintf               pg_vfprintf
-#define fprintf                        pg_fprintf
-#define vprintf                        pg_vprintf
-#define printf(...)            pg_printf(__VA_ARGS__)
-
-=======
->>>>>>> REL_16_9
 #endif                                                 /* PLPYTHON_SYSTEM_H */
diff --git a/src/pl/tcl/nls.mk b/src/pl/tcl/nls.mk
index eacf09d31e6..8366998df15 100644
--- a/src/pl/tcl/nls.mk
+++ b/src/pl/tcl/nls.mk
@@ -1,9 +1,5 @@
 # src/pl/tcl/nls.mk
 CATALOG_NAME     = pltcl
-<<<<<<< HEAD
-AVAIL_LANGUAGES  = cs de el es fr it ja ko pl ru sv tr uk vi zh_CN
-=======
->>>>>>> REL_16_9
 GETTEXT_FILES    = pltcl.c
 GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS)
 GETTEXT_FLAGS    = $(BACKEND_COMMON_GETTEXT_FLAGS)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to