[ Redirecting thread to -hackers from -committers ] On 2022-Jul-19, Tom Lane wrote:
> Alvaro Herrera <alvhe...@alvh.no-ip.org> writes: > > Do you just need to send a patch to add an exports.txt file to > > src/pl/plpgsql/src/ for these functions? > > The precedent of plpython says that PGDLLEXPORT markers are sufficient. > But yeah, we need a list of exactly which functions need to be > re-exposed. I imagine pldebugger has its own needs. A reasonable guess. I went as far as downloading pldebugger and compiling it, but it doesn't have a test suite of its own, so I couldn't verify anything about it. I did notice that plpgsql_check is calling function load_external_function(), and that doesn't appear in pldebugger. I wonder if the find_rendezvous_variable business is at play. Anyway, the minimal patch that makes plpgsql_check tests pass is attached. This seems a bit random. Maybe it'd be better to have a plpgsql_internal.h with functions that are exported only for plpgsql itself, and keep plpgsql.h with a set of functions, all marked PGDLLEXPORT, that are for external use. ... oh, and: $ postmaster -c shared_preload_libraries=plugin_debugger 2022-07-19 16:27:24.006 CEST [742142] FATAL: cannot request additional shared memory outside shmem_request_hook -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
>From e0759245de3e0fcad7a6b2c3e9a637d3bdffe2a4 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera <alvhe...@alvh.no-ip.org> Date: Tue, 19 Jul 2022 16:19:03 +0200 Subject: [PATCH] add PGDLLEXPORTS to plpgsql for plpgsql_check benefit --- src/pl/plpgsql/src/plpgsql.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index 1914160272..20dd5ec060 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -1231,10 +1231,10 @@ extern PLpgSQL_plugin **plpgsql_plugin_ptr; /* * Functions in pl_comp.c */ -extern PLpgSQL_function *plpgsql_compile(FunctionCallInfo fcinfo, +extern PGDLLEXPORT PLpgSQL_function *plpgsql_compile(FunctionCallInfo fcinfo, bool forValidator); extern PLpgSQL_function *plpgsql_compile_inline(char *proc_source); -extern void plpgsql_parser_setup(struct ParseState *pstate, +extern PGDLLEXPORT void plpgsql_parser_setup(struct ParseState *pstate, PLpgSQL_expr *expr); extern bool plpgsql_parse_word(char *word1, const char *yytxt, bool lookup, PLwdatum *wdatum, PLword *word); @@ -1246,7 +1246,7 @@ extern PLpgSQL_type *plpgsql_parse_wordtype(char *ident); extern PLpgSQL_type *plpgsql_parse_cwordtype(List *idents); extern PLpgSQL_type *plpgsql_parse_wordrowtype(char *ident); extern PLpgSQL_type *plpgsql_parse_cwordrowtype(List *idents); -extern PLpgSQL_type *plpgsql_build_datatype(Oid typeOid, int32 typmod, +extern PGDLLEXPORT PLpgSQL_type *plpgsql_build_datatype(Oid typeOid, int32 typmod, Oid collation, TypeName *origtypname); extern PLpgSQL_variable *plpgsql_build_variable(const char *refname, int lineno, @@ -1257,7 +1257,7 @@ extern PLpgSQL_rec *plpgsql_build_record(const char *refname, int lineno, bool add2namespace); extern PLpgSQL_recfield *plpgsql_build_recfield(PLpgSQL_rec *rec, const char *fldname); -extern int plpgsql_recognize_err_condition(const char *condname, +extern PGDLLEXPORT int plpgsql_recognize_err_condition(const char *condname, bool allow_sqlstate); extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname); extern void plpgsql_adddatum(PLpgSQL_datum *newdatum); @@ -1280,7 +1280,7 @@ extern void plpgsql_exec_event_trigger(PLpgSQL_function *func, extern void plpgsql_xact_cb(XactEvent event, void *arg); extern void plpgsql_subxact_cb(SubXactEvent event, SubTransactionId mySubid, SubTransactionId parentSubid, void *arg); -extern Oid plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, +extern PGDLLEXPORT Oid plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, PLpgSQL_datum *datum); extern void plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, PLpgSQL_datum *datum, @@ -1296,7 +1296,7 @@ extern void plpgsql_ns_push(const char *label, extern void plpgsql_ns_pop(void); extern PLpgSQL_nsitem *plpgsql_ns_top(void); extern void plpgsql_ns_additem(PLpgSQL_nsitem_type itemtype, int itemno, const char *name); -extern PLpgSQL_nsitem *plpgsql_ns_lookup(PLpgSQL_nsitem *ns_cur, bool localmode, +extern PGDLLEXPORT PLpgSQL_nsitem *plpgsql_ns_lookup(PLpgSQL_nsitem *ns_cur, bool localmode, const char *name1, const char *name2, const char *name3, int *names_used); extern PLpgSQL_nsitem *plpgsql_ns_lookup_label(PLpgSQL_nsitem *ns_cur, @@ -1306,7 +1306,7 @@ extern PLpgSQL_nsitem *plpgsql_ns_find_nearest_loop(PLpgSQL_nsitem *ns_cur); /* * Other functions in pl_funcs.c */ -extern const char *plpgsql_stmt_typename(PLpgSQL_stmt *stmt); +extern PGDLLEXPORT const char *plpgsql_stmt_typename(PLpgSQL_stmt *stmt); extern const char *plpgsql_getdiag_kindname(PLpgSQL_getdiag_kind kind); extern void plpgsql_free_function_memory(PLpgSQL_function *func); extern void plpgsql_dumptree(PLpgSQL_function *func); -- 2.30.2