mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 00:01:55 -04:00
Compare commits
No commits in common. "76dd3d94a50435f57efc4da29e27a1bf69862726" and "ab04c1901d0d55039330bc02f9f4e1024b2a95dc" have entirely different histories.
76dd3d94a5
...
ab04c1901d
@ -1451,8 +1451,7 @@ CONTEXT: processing remote data for replication origin "pg_16395" during "INSER
|
|||||||
implemented by <quote>walsender</quote> and <quote>apply</quote>
|
implemented by <quote>walsender</quote> and <quote>apply</quote>
|
||||||
processes. The walsender process starts logical decoding (described
|
processes. The walsender process starts logical decoding (described
|
||||||
in <xref linkend="logicaldecoding"/>) of the WAL and loads the standard
|
in <xref linkend="logicaldecoding"/>) of the WAL and loads the standard
|
||||||
logical decoding output plugin (<literal>pgoutput</literal>). The plugin
|
logical decoding plugin (pgoutput). The plugin transforms the changes read
|
||||||
transforms the changes read
|
|
||||||
from WAL to the logical replication protocol
|
from WAL to the logical replication protocol
|
||||||
(see <xref linkend="protocol-logical-replication"/>) and filters the data
|
(see <xref linkend="protocol-logical-replication"/>) and filters the data
|
||||||
according to the publication specification. The data is then continuously
|
according to the publication specification. The data is then continuously
|
||||||
|
@ -2559,10 +2559,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"
|
|||||||
<term><replaceable class="parameter">option_name</replaceable></term>
|
<term><replaceable class="parameter">option_name</replaceable></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
The name of an option passed to the slot's logical decoding output
|
The name of an option passed to the slot's logical decoding plugin.
|
||||||
plugin. See <xref linkend="protocol-logical-replication"/> for
|
|
||||||
options that are accepted by the standard (<literal>pgoutput</literal>)
|
|
||||||
plugin.
|
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@ -3091,18 +3088,12 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"
|
|||||||
the physical streaming replication protocol.
|
the physical streaming replication protocol.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
|
||||||
<productname>PostgreSQL</productname> logical decoding supports output
|
|
||||||
plugins. <literal>pgoutput</literal> is the standard one used for
|
|
||||||
the built-in logical replication.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<sect2 id="protocol-logical-replication-params">
|
<sect2 id="protocol-logical-replication-params">
|
||||||
<title>Logical Streaming Replication Parameters</title>
|
<title>Logical Streaming Replication Parameters</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Using the <literal>START_REPLICATION</literal> command,
|
The logical replication <literal>START_REPLICATION</literal> command
|
||||||
<literal>pgoutput</literal> accepts the following options:
|
accepts following parameters:
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
@ -3112,7 +3103,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Protocol version. Currently versions <literal>1</literal>, <literal>2</literal>,
|
Protocol version. Currently versions <literal>1</literal>, <literal>2</literal>,
|
||||||
and <literal>3</literal> are supported. A valid version is required.
|
and <literal>3</literal> are supported.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Version <literal>2</literal> is supported only for server version 14
|
Version <literal>2</literal> is supported only for server version 14
|
||||||
@ -3134,55 +3125,6 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"
|
|||||||
Comma separated list of publication names for which to subscribe
|
Comma separated list of publication names for which to subscribe
|
||||||
(receive changes). The individual publication names are treated
|
(receive changes). The individual publication names are treated
|
||||||
as standard objects names and can be quoted the same as needed.
|
as standard objects names and can be quoted the same as needed.
|
||||||
At least one publication name is required.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
binary
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
Boolean option to use binary transfer mode. Binary mode is faster
|
|
||||||
than the text mode but slightly less robust.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
messages
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
Boolean option to enable sending the messages that are written
|
|
||||||
by <function>pg_logical_emit_message</function>.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
streaming
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
Boolean option to enable streaming of in-progress transactions.
|
|
||||||
Minimum protocol version 2 is required to turn it on.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
two_phase
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
Boolean option to enable two-phase transactions. Minimum protocol
|
|
||||||
version 3 is required to turn it on.
|
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
@ -7643,12 +7643,9 @@ set_config_option_ext(const char *name, const char *value,
|
|||||||
* Other changes might need to affect other workers, so forbid them.
|
* Other changes might need to affect other workers, so forbid them.
|
||||||
*/
|
*/
|
||||||
if (IsInParallelMode() && changeVal && action != GUC_ACTION_SAVE)
|
if (IsInParallelMode() && changeVal && action != GUC_ACTION_SAVE)
|
||||||
{
|
|
||||||
ereport(elevel,
|
ereport(elevel,
|
||||||
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
|
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
|
||||||
errmsg("cannot set parameters during a parallel operation")));
|
errmsg("cannot set parameters during a parallel operation")));
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
record = find_option(name, true, false, elevel);
|
record = find_option(name, true, false, elevel);
|
||||||
if (record == NULL)
|
if (record == NULL)
|
||||||
@ -7743,10 +7740,6 @@ set_config_option_ext(const char *name, const char *value,
|
|||||||
* backends. This is a tad klugy, but necessary because we
|
* backends. This is a tad klugy, but necessary because we
|
||||||
* don't re-read the config file during backend start.
|
* don't re-read the config file during backend start.
|
||||||
*
|
*
|
||||||
* However, if changeVal is false then plow ahead anyway since
|
|
||||||
* we are trying to find out if the value is potentially good,
|
|
||||||
* not actually use it.
|
|
||||||
*
|
|
||||||
* In EXEC_BACKEND builds, this works differently: we load all
|
* In EXEC_BACKEND builds, this works differently: we load all
|
||||||
* non-default settings from the CONFIG_EXEC_PARAMS file
|
* non-default settings from the CONFIG_EXEC_PARAMS file
|
||||||
* during backend start. In that case we must accept
|
* during backend start. In that case we must accept
|
||||||
@ -7757,7 +7750,7 @@ set_config_option_ext(const char *name, const char *value,
|
|||||||
* started it. is_reload will be true when either situation
|
* started it. is_reload will be true when either situation
|
||||||
* applies.
|
* applies.
|
||||||
*/
|
*/
|
||||||
if (IsUnderPostmaster && changeVal && !is_reload)
|
if (IsUnderPostmaster && !is_reload)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (context != PGC_POSTMASTER &&
|
else if (context != PGC_POSTMASTER &&
|
||||||
|
@ -103,11 +103,11 @@ uninstall: uninstall-lib uninstall-data
|
|||||||
|
|
||||||
install-data: installdirs
|
install-data: installdirs
|
||||||
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) '$(DESTDIR)$(datadir)/extension/'
|
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) '$(DESTDIR)$(datadir)/extension/'
|
||||||
$(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)/ppport.h $(srcdir)/plperl_helpers.h '$(DESTDIR)$(includedir_server)'
|
||||||
|
|
||||||
uninstall-data:
|
uninstall-data:
|
||||||
rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA)))
|
rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA)))
|
||||||
rm -f $(addprefix '$(DESTDIR)$(includedir_server)'/, plperl.h plperl_system.h ppport.h)
|
rm -f $(addprefix '$(DESTDIR)$(includedir_server)'/, plperl.h ppport.h)
|
||||||
|
|
||||||
.PHONY: install-data uninstall-data
|
.PHONY: install-data uninstall-data
|
||||||
|
|
||||||
|
@ -14,11 +14,200 @@
|
|||||||
#ifndef PL_PERL_H
|
#ifndef PL_PERL_H
|
||||||
#define PL_PERL_H
|
#define PL_PERL_H
|
||||||
|
|
||||||
|
/* stop perl headers from hijacking stdio and other stuff on Windows */
|
||||||
|
#ifdef WIN32
|
||||||
|
#define WIN32IO_IS_STDIO
|
||||||
|
#endif /* WIN32 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pull in Perl headers via a wrapper header, to control the scope of
|
* Supply a value of PERL_UNUSED_DECL that will satisfy gcc - the one
|
||||||
* the system_header pragma therein.
|
* perl itself supplies doesn't seem to.
|
||||||
*/
|
*/
|
||||||
#include "plperl_system.h"
|
#define PERL_UNUSED_DECL pg_attribute_unused()
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sometimes perl 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
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Perl scribbles on the "_" macro too.
|
||||||
|
*/
|
||||||
|
#undef _
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ActivePerl 5.18 and later are MinGW-built, and their headers use GCC's
|
||||||
|
* __inline__. Translate to something MSVC recognizes. Also, perl.h sometimes
|
||||||
|
* defines isnan, so undefine it here and put back the definition later if
|
||||||
|
* perl.h doesn't.
|
||||||
|
*/
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define __inline__ inline
|
||||||
|
#ifdef isnan
|
||||||
|
#undef isnan
|
||||||
|
#endif
|
||||||
|
/* Work around for using MSVC and Strawberry Perl >= 5.30. */
|
||||||
|
#define __builtin_expect(expr, val) (expr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Regarding bool, both PostgreSQL and Perl might use stdbool.h or not,
|
||||||
|
* depending on configuration. If both agree, things are relatively harmless.
|
||||||
|
* If not, things get tricky. If PostgreSQL does but Perl does not, define
|
||||||
|
* HAS_BOOL here so that Perl does not redefine bool; this avoids compiler
|
||||||
|
* warnings. If PostgreSQL does not but Perl does, we need to undefine bool
|
||||||
|
* after we include the Perl headers; see below.
|
||||||
|
*/
|
||||||
|
#ifdef PG_USE_STDBOOL
|
||||||
|
#define HAS_BOOL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Newer versions of the perl headers trigger a lot of warnings with our
|
||||||
|
* compiler flags (at least -Wdeclaration-after-statement,
|
||||||
|
* -Wshadow=compatible-local are known to be problematic). The system_header
|
||||||
|
* pragma hides warnings from within the rest of this file, if supported.
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_PRAGMA_GCC_SYSTEM_HEADER
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the basic Perl API. We use PERL_NO_GET_CONTEXT mode so that our code
|
||||||
|
* can compile against MULTIPLICITY Perl builds without including XSUB.h.
|
||||||
|
*/
|
||||||
|
#define PERL_NO_GET_CONTEXT
|
||||||
|
#include "EXTERN.h"
|
||||||
|
#include "perl.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We want to include XSUB.h only within .xs files, because on some platforms
|
||||||
|
* it undesirably redefines a lot of libc functions. But it must appear
|
||||||
|
* before ppport.h, so use a #define flag to control inclusion here.
|
||||||
|
*/
|
||||||
|
#ifdef PG_NEED_PERL_XSUB_H
|
||||||
|
/*
|
||||||
|
* On Windows, win32_port.h defines macros for a lot of these same functions.
|
||||||
|
* To avoid compiler warnings when XSUB.h redefines them, #undef our versions.
|
||||||
|
*/
|
||||||
|
#ifdef WIN32
|
||||||
|
#undef accept
|
||||||
|
#undef bind
|
||||||
|
#undef connect
|
||||||
|
#undef fopen
|
||||||
|
#undef fstat
|
||||||
|
#undef kill
|
||||||
|
#undef listen
|
||||||
|
#undef lstat
|
||||||
|
#undef mkdir
|
||||||
|
#undef open
|
||||||
|
#undef putenv
|
||||||
|
#undef recv
|
||||||
|
#undef rename
|
||||||
|
#undef select
|
||||||
|
#undef send
|
||||||
|
#undef socket
|
||||||
|
#undef stat
|
||||||
|
#undef unlink
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "XSUB.h"
|
||||||
|
#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__)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Put back "_" too; but rather than making it just gettext() as the core
|
||||||
|
* code does, make it dgettext() so that the right things will happen in
|
||||||
|
* loadable modules (if they've set up TEXTDOMAIN correctly). Note that
|
||||||
|
* we can't just set TEXTDOMAIN here, because this file is used by more
|
||||||
|
* extensions than just PL/Perl itself.
|
||||||
|
*/
|
||||||
|
#undef _
|
||||||
|
#define _(x) dgettext(TEXTDOMAIN, x)
|
||||||
|
|
||||||
|
/* put back the definition of isnan if needed */
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#ifndef isnan
|
||||||
|
#define isnan(x) _isnan(x)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* perl version and platform portability */
|
||||||
|
#include "ppport.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* perl might have included stdbool.h. If we also did that earlier (see c.h),
|
||||||
|
* then that's fine. If not, we probably rejected it for some reason. In
|
||||||
|
* that case, undef bool and proceed with our own bool. (Note that stdbool.h
|
||||||
|
* makes bool a macro, but our own replacement is a typedef, so the undef
|
||||||
|
* makes ours visible again).
|
||||||
|
*/
|
||||||
|
#ifndef PG_USE_STDBOOL
|
||||||
|
#ifdef bool
|
||||||
|
#undef bool
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */
|
||||||
|
#ifndef HeUTF8
|
||||||
|
#define HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \
|
||||||
|
SvUTF8(HeKEY_sv(he)) : \
|
||||||
|
(U32)HeKUTF8(he))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* supply GvCV_set if it's missing - ppport.h doesn't supply it, unfortunately */
|
||||||
|
#ifndef GvCV_set
|
||||||
|
#define GvCV_set(gv, cv) (GvCV(gv) = cv)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Perl 5.19.4 changed array indices from I32 to SSize_t */
|
||||||
|
#if PERL_BCDVERSION >= 0x5019004
|
||||||
|
#define AV_SIZE_MAX SSize_t_MAX
|
||||||
|
#else
|
||||||
|
#define AV_SIZE_MAX I32_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
/* declare routines from plperl.c for access by .xs files */
|
/* declare routines from plperl.c for access by .xs files */
|
||||||
HV *plperl_spi_exec(char *, int);
|
HV *plperl_spi_exec(char *, int);
|
||||||
|
@ -1,215 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* plperl_system.h
|
|
||||||
* Pull in Perl's system header files.
|
|
||||||
*
|
|
||||||
* We break this out as a separate header file to precisely control
|
|
||||||
* the scope of the "system_header" pragma. No Postgres-specific
|
|
||||||
* declarations should be put here. However, we do include some stuff
|
|
||||||
* that is meant to prevent conflicts between our code and Perl.
|
|
||||||
*
|
|
||||||
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
|
||||||
* Portions Copyright (c) 1995, Regents of the University of California
|
|
||||||
*
|
|
||||||
* src/pl/plperl/plperl_system.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PL_PERL_SYSTEM_H
|
|
||||||
#define PL_PERL_SYSTEM_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Newer versions of the perl headers trigger a lot of warnings with our
|
|
||||||
* preferred compiler flags (at least -Wdeclaration-after-statement,
|
|
||||||
* -Wshadow=compatible-local are known to be problematic). The system_header
|
|
||||||
* pragma hides warnings from within the rest of this file, if supported.
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_PRAGMA_GCC_SYSTEM_HEADER
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* stop perl headers from hijacking stdio and other stuff on Windows */
|
|
||||||
#ifdef WIN32
|
|
||||||
#define WIN32IO_IS_STDIO
|
|
||||||
#endif /* WIN32 */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Supply a value of PERL_UNUSED_DECL that will satisfy gcc - the one
|
|
||||||
* perl itself supplies doesn't seem to.
|
|
||||||
*/
|
|
||||||
#define PERL_UNUSED_DECL pg_attribute_unused()
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sometimes perl 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
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Perl scribbles on the "_" macro too.
|
|
||||||
*/
|
|
||||||
#undef _
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ActivePerl 5.18 and later are MinGW-built, and their headers use GCC's
|
|
||||||
* __inline__. Translate to something MSVC recognizes. Also, perl.h sometimes
|
|
||||||
* defines isnan, so undefine it here and put back the definition later if
|
|
||||||
* perl.h doesn't.
|
|
||||||
*/
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define __inline__ inline
|
|
||||||
#ifdef isnan
|
|
||||||
#undef isnan
|
|
||||||
#endif
|
|
||||||
/* Work around for using MSVC and Strawberry Perl >= 5.30. */
|
|
||||||
#define __builtin_expect(expr, val) (expr)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Regarding bool, both PostgreSQL and Perl might use stdbool.h or not,
|
|
||||||
* depending on configuration. If both agree, things are relatively harmless.
|
|
||||||
* If not, things get tricky. If PostgreSQL does but Perl does not, define
|
|
||||||
* HAS_BOOL here so that Perl does not redefine bool; this avoids compiler
|
|
||||||
* warnings. If PostgreSQL does not but Perl does, we need to undefine bool
|
|
||||||
* after we include the Perl headers; see below.
|
|
||||||
*/
|
|
||||||
#ifdef PG_USE_STDBOOL
|
|
||||||
#define HAS_BOOL 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the basic Perl API. We use PERL_NO_GET_CONTEXT mode so that our code
|
|
||||||
* can compile against MULTIPLICITY Perl builds without including XSUB.h.
|
|
||||||
*/
|
|
||||||
#define PERL_NO_GET_CONTEXT
|
|
||||||
#include "EXTERN.h"
|
|
||||||
#include "perl.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We want to include XSUB.h only within .xs files, because on some platforms
|
|
||||||
* it undesirably redefines a lot of libc functions. But it must appear
|
|
||||||
* before ppport.h, so use a #define flag to control inclusion here.
|
|
||||||
*/
|
|
||||||
#ifdef PG_NEED_PERL_XSUB_H
|
|
||||||
/*
|
|
||||||
* On Windows, win32_port.h defines macros for a lot of these same functions.
|
|
||||||
* To avoid compiler warnings when XSUB.h redefines them, #undef our versions.
|
|
||||||
*/
|
|
||||||
#ifdef WIN32
|
|
||||||
#undef accept
|
|
||||||
#undef bind
|
|
||||||
#undef connect
|
|
||||||
#undef fopen
|
|
||||||
#undef fstat
|
|
||||||
#undef kill
|
|
||||||
#undef listen
|
|
||||||
#undef lstat
|
|
||||||
#undef mkdir
|
|
||||||
#undef open
|
|
||||||
#undef putenv
|
|
||||||
#undef recv
|
|
||||||
#undef rename
|
|
||||||
#undef select
|
|
||||||
#undef send
|
|
||||||
#undef socket
|
|
||||||
#undef stat
|
|
||||||
#undef unlink
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "XSUB.h"
|
|
||||||
#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__)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Put back "_" too; but rather than making it just gettext() as the core
|
|
||||||
* code does, make it dgettext() so that the right things will happen in
|
|
||||||
* loadable modules (if they've set up TEXTDOMAIN correctly). Note that
|
|
||||||
* we can't just set TEXTDOMAIN here, because this file is used by more
|
|
||||||
* extensions than just PL/Perl itself.
|
|
||||||
*/
|
|
||||||
#undef _
|
|
||||||
#define _(x) dgettext(TEXTDOMAIN, x)
|
|
||||||
|
|
||||||
/* put back the definition of isnan if needed */
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#ifndef isnan
|
|
||||||
#define isnan(x) _isnan(x)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* perl version and platform portability */
|
|
||||||
#include "ppport.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* perl might have included stdbool.h. If we also did that earlier (see c.h),
|
|
||||||
* then that's fine. If not, we probably rejected it for some reason. In
|
|
||||||
* that case, undef bool and proceed with our own bool. (Note that stdbool.h
|
|
||||||
* makes bool a macro, but our own replacement is a typedef, so the undef
|
|
||||||
* makes ours visible again).
|
|
||||||
*/
|
|
||||||
#ifndef PG_USE_STDBOOL
|
|
||||||
#ifdef bool
|
|
||||||
#undef bool
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */
|
|
||||||
#ifndef HeUTF8
|
|
||||||
#define HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \
|
|
||||||
SvUTF8(HeKEY_sv(he)) : \
|
|
||||||
(U32)HeKUTF8(he))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* supply GvCV_set if it's missing - ppport.h doesn't supply it, unfortunately */
|
|
||||||
#ifndef GvCV_set
|
|
||||||
#define GvCV_set(gv, cv) (GvCV(gv) = cv)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Perl 5.19.4 changed array indices from I32 to SSize_t */
|
|
||||||
#if PERL_BCDVERSION >= 0x5019004
|
|
||||||
#define AV_SIZE_MAX SSize_t_MAX
|
|
||||||
#else
|
|
||||||
#define AV_SIZE_MAX I32_MAX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* PL_PERL_SYSTEM_H */
|
|
@ -39,7 +39,6 @@ DATA = $(NAME)u.control $(NAME)u--1.0.sql
|
|||||||
# header files to install - it's not clear which of these might be needed
|
# header files to install - it's not clear which of these might be needed
|
||||||
# so install them all.
|
# so install them all.
|
||||||
INCS = plpython.h \
|
INCS = plpython.h \
|
||||||
plpython_system.h \
|
|
||||||
plpy_cursorobject.h \
|
plpy_cursorobject.h \
|
||||||
plpy_elog.h \
|
plpy_elog.h \
|
||||||
plpy_exec.h \
|
plpy_exec.h \
|
||||||
@ -121,7 +120,7 @@ install-data: installdirs
|
|||||||
|
|
||||||
uninstall-data:
|
uninstall-data:
|
||||||
rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA)))
|
rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA)))
|
||||||
rm -f $(addprefix '$(DESTDIR)$(includedir_server)'/, $(INCS))
|
rm -f $(addprefix '$(DESTDIR)$(includedir_server)'/, plpython.h plpy_util.h)
|
||||||
|
|
||||||
.PHONY: install-data uninstall-data
|
.PHONY: install-data uninstall-data
|
||||||
|
|
||||||
|
@ -22,15 +22,82 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pull in Python headers via a wrapper header, to control the scope of
|
* Undefine some things that get (re)defined in the Python headers. They aren't
|
||||||
* the system_header pragma therein.
|
* used by the PL/Python code, and all PostgreSQL headers should be included
|
||||||
|
* earlier, so this should be pretty safe.
|
||||||
*/
|
*/
|
||||||
#include "plpython_system.h"
|
#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
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||||
|
/* Python uses #pragma to bring in a non-default libpython on VC++ if
|
||||||
|
* _DEBUG is defined */
|
||||||
|
#undef _DEBUG
|
||||||
|
/* Also hide away errcode, since we load Python.h before postgres.h */
|
||||||
|
#define errcode __msvc_errcode
|
||||||
|
#include <Python.h>
|
||||||
|
#undef errcode
|
||||||
|
#define _DEBUG
|
||||||
|
#elif defined (_MSC_VER)
|
||||||
|
#define errcode __msvc_errcode
|
||||||
|
#include <Python.h>
|
||||||
|
#undef errcode
|
||||||
|
#else
|
||||||
|
#include <Python.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* define our text domain for translations */
|
/* define our text domain for translations */
|
||||||
#undef TEXTDOMAIN
|
#undef TEXTDOMAIN
|
||||||
#define TEXTDOMAIN PG_TEXTDOMAIN("plpython")
|
#define TEXTDOMAIN PG_TEXTDOMAIN("plpython")
|
||||||
|
|
||||||
|
/* 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__)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Used throughout, so it's easier to just include it everywhere.
|
* Used throughout, so it's easier to just include it everywhere.
|
||||||
*/
|
*/
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* plpython_system.h - pull in Python's system header files
|
|
||||||
*
|
|
||||||
* We break this out as a separate header file to precisely control
|
|
||||||
* the scope of the "system_header" pragma. No Postgres-specific
|
|
||||||
* declarations should be put here. However, we do include some stuff
|
|
||||||
* that is meant to prevent conflicts between our code and Python.
|
|
||||||
*
|
|
||||||
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
|
||||||
*
|
|
||||||
* src/pl/plpython/plpython_system.h
|
|
||||||
*
|
|
||||||
*-------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
#ifndef PLPYTHON_SYSTEM_H
|
|
||||||
#define PLPYTHON_SYSTEM_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Newer versions of the Python headers trigger a lot of warnings with our
|
|
||||||
* preferred compiler flags (at least -Wdeclaration-after-statement is known
|
|
||||||
* to be problematic). The system_header pragma hides warnings from within
|
|
||||||
* the rest of this file, if supported.
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_PRAGMA_GCC_SYSTEM_HEADER
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
|
||||||
/* Python uses #pragma to bring in a non-default libpython on VC++ if
|
|
||||||
* _DEBUG is defined */
|
|
||||||
#undef _DEBUG
|
|
||||||
/* Also hide away errcode, since we load Python.h before postgres.h */
|
|
||||||
#define errcode __msvc_errcode
|
|
||||||
#include <Python.h>
|
|
||||||
#undef errcode
|
|
||||||
#define _DEBUG
|
|
||||||
#elif defined (_MSC_VER)
|
|
||||||
#define errcode __msvc_errcode
|
|
||||||
#include <Python.h>
|
|
||||||
#undef errcode
|
|
||||||
#else
|
|
||||||
#include <Python.h>
|
|
||||||
#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__)
|
|
||||||
|
|
||||||
#endif /* PLPYTHON_SYSTEM_H */
|
|
Loading…
x
Reference in New Issue
Block a user