Re: Ashutosh Sharma 2017-07-31
<cae9k0pnzyxykhuwjonuedt2xunpuc8vuvpwsd0bscrd3u+j...@mail.gmail.com>
> > The only interesting line in log/postmaster.log is a log_line_prefix-less
> > Util.c: loadable library and perl binaries are mismatched (got handshake
> > key 0xd500080, needed 0xd600080)
> > ... which is unchanged from the beta2 output.
>
>
> I am not able to reproduce this issue on my Windows or Linux box. Have
> you deleted Util.c and SPI.c files before starting with the build?
That was from a git checkout which didn't contain the files.
Retrying anyway:
[127] 10:28 myon@experimental_k-a-dchroot.falla:~/po/po/src/pl/plperl $ make
clean
rm -f plperl.so libplperl.a libplperl.pc
rm -f SPI.c Util.c plperl.o SPI.o Util.o perlchunks.h plperl_opmask.h
rm -rf results/ regression.diffs regression.out tmp_check/ tmp_check_iso/ log/
output_iso/
[0] 10:29 myon@experimental_k-a-dchroot.falla:~/po/po/src/pl/plperl $ make
'/usr/bin/perl' ./text2macro.pl --strip='^(\#.*|\s*)$' plc_perlboot.pl
plc_trusted.pl > perlchunks.h
'/usr/bin/perl' plperl_opmask.pl plperl_opmask.h
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement
-Wendif-labels -Wmissing-format-attribute -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I.
-I../../../src/include -D_GNU_SOURCE
-I/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE -c -o plperl.o plperl.c
'/usr/bin/perl' /usr/share/perl/5.26/ExtUtils/xsubpp -typemap
/usr/share/perl/5.26/ExtUtils/typemap SPI.xs >SPI.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement
-Wendif-labels -Wmissing-format-attribute -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I.
-I../../../src/include -D_GNU_SOURCE
-I/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE -c -o SPI.o SPI.c
'/usr/bin/perl' /usr/share/perl/5.26/ExtUtils/xsubpp -typemap
/usr/share/perl/5.26/ExtUtils/typemap Util.xs >Util.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement
-Wendif-labels -Wmissing-format-attribute -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I.
-I../../../src/include -D_GNU_SOURCE
-I/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE -c -o Util.o Util.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement
-Wendif-labels -Wmissing-format-attribute -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -shared -o
plperl.so plperl.o SPI.o Util.o -L../../../src/port -L../../../src/common
-Wl,--as-needed
-Wl,-rpath,'/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE',--enable-new-dtags
-fstack-protector-strong -L/usr/local/lib
-L/usr/lib/x86_64-kfreebsd-gnu/perl/5.26/CORE -lperl -ldl -lm -lpthread -lc
-lcrypt
[0] 10:29 myon@experimental_k-a-dchroot.falla:~/po/po/src/pl/plperl $ make check
make -C ../../../src/test/regress pg_regress
make[1]: Verzeichnis
„/home/myon/postgresql-10/postgresql-10-10~beta2/src/test/regress“ wird betreten
make -C ../../../src/port all
make[2]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/port“
wird betreten
make -C ../backend submake-errcodes
make[3]: Verzeichnis
„/home/myon/postgresql-10/postgresql-10-10~beta2/src/backend“ wird betreten
make[3]: Für das Ziel „submake-errcodes“ ist nichts zu tun.
make[3]: Verzeichnis
„/home/myon/postgresql-10/postgresql-10-10~beta2/src/backend“ wird verlassen
make[2]: Verzeichnis „/home/myon/postgresql-10/postgresql-10-10~beta2/src/port“
wird verlassen
make -C ../../../src/common all
make[2]: Verzeichnis
„/home/myon/postgresql-10/postgresql-10-10~beta2/src/common“ wird betreten
make -C ../backend submake-errcodes
make[3]: Verzeichnis
„/home/myon/postgresql-10/postgresql-10-10~beta2/src/backend“ wird betreten
make[3]: Für das Ziel „submake-errcodes“ ist nichts zu tun.
make[3]: Verzeichnis
„/home/myon/postgresql-10/postgresql-10-10~beta2/src/backend“ wird verlassen
make[2]: Verzeichnis
„/home/myon/postgresql-10/postgresql-10-10~beta2/src/common“ wird verlassen
make[1]: Verzeichnis
„/home/myon/postgresql-10/postgresql-10-10~beta2/src/test/regress“ wird
verlassen
rm -rf '/home/myon/postgresql-10/postgresql-10-10~beta2'/tmp_install
/bin/mkdir -p '/home/myon/postgresql-10/postgresql-10-10~beta2'/tmp_install/log
make -C '../../..'
DESTDIR='/home/myon/postgresql-10/postgresql-10-10~beta2'/tmp_install install
>'/home/myon/postgresql-10/postgresql-10-10~beta2'/tmp_install/log/install.log
2>&1
PATH="/home/myon/postgresql-10/postgresql-10-10~beta2/tmp_install/usr/local/pgsql/bin:$PATH"
LD_LIBRARY_PATH="/home/myon/postgresql-10/postgresql-10-10~beta2/tmp_install/usr/local/pgsql/lib"
../../../src/test/regress/pg_regress --temp-instance=./tmp_check --inputdir=.
--bindir= --dbname=pl_regression --load-extension=plperl
--load-extension=plperlu plperl plperl_lc plperl_trigger plperl_shared
plperl_elog plperl_util plperl_init plperlu plperl_array plperl_plperlu
============== creating temporary instance ==============
============== initializing database system ==============
============== starting postmaster ==============
running on port 50848 with PID 17713
============== creating database "pl_regression" ==============
CREATE DATABASE
ALTER DATABASE
============== installing plperl ==============
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
connection to server was lost
command failed: "psql" -X -c "CREATE EXTENSION IF NOT EXISTS \"plperl\""
"pl_regression"
GNUmakefile:108: die Regel für Ziel „check“ scheiterte
make: *** [check] Fehler 2
[2] 10:29 myon@experimental_k-a-dchroot.falla:~/po/po/src/pl/plperl $ cat
log/postmaster.log
2017-07-31 10:29:54.995 CEST [17713] LOG: listening on Unix socket
"/tmp/pg_regress-JaWXuT/.s.PGSQL.50848"
2017-07-31 10:29:55.015 CEST [17716] LOG: database system was shut down at
2017-07-31 10:29:54 CEST
2017-07-31 10:29:55.023 CEST [17713] LOG: database system is ready to accept
connections
2017-07-31 10:29:56.068 CEST [17717] LOG: checkpoint starting: immediate force
wait flush-all
2017-07-31 10:29:56.071 CEST [17717] LOG: checkpoint complete: wrote 3 buffers
(0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.000 s, sync=0.000
s, total=0.002 s; sync files=0, longest=0.000 s, average=0.000 s; distance=1
kB, estimate=1 kB
2017-07-31 10:29:56.303 CEST [17717] LOG: checkpoint starting: immediate force
wait
2017-07-31 10:29:56.305 CEST [17717] LOG: checkpoint complete: wrote 0 buffers
(0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.000 s, sync=0.000
s, total=0.001 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0
kB, estimate=1 kB
Util.c: loadable library and perl binaries are mismatched (got handshake key
0xd500080, needed 0xd600080)
2017-07-31 10:29:56.478 CEST [17713] LOG: received fast shutdown request
2017-07-31 10:29:56.478 CEST [17713] LOG: aborting any active transactions
2017-07-31 10:29:56.480 CEST [17713] LOG: worker process: logical replication
launcher (PID 17722) exited with exit code 1
2017-07-31 10:29:56.481 CEST [17717] LOG: shutting down
2017-07-31 10:29:56.481 CEST [17717] LOG: checkpoint starting: shutdown
immediate
2017-07-31 10:29:56.484 CEST [17717] LOG: checkpoint complete: wrote 19
buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s,
sync=0.000 s, total=0.003 s; sync files=0, longest=0.000 s, average=0.000 s;
distance=47 kB, estimate=47 kB
2017-07-31 10:29:56.494 CEST [17713] LOG: database system is shut down
Christoph
/*
* This file was generated automatically by ExtUtils::ParseXS version 3.34 from the
* contents of SPI.xs. Do not edit this file, edit SPI.xs instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
#line 1 "SPI.xs"
/**********************************************************************
* PostgreSQL::InServer::SPI
*
* SPI interface for plperl.
*
* src/pl/plperl/SPI.xs
*
**********************************************************************/
/* this must be first: */
#include "postgres.h"
#include "mb/pg_wchar.h" /* for GetDatabaseEncoding */
/* Defined by Perl */
#undef _
/* perl stuff */
#include "plperl.h"
#include "plperl_helpers.h"
/*
* Interface routine to catch ereports and punt them to Perl
*/
static void
do_plperl_return_next(SV *sv)
{
MemoryContext oldcontext = CurrentMemoryContext;
PG_TRY();
{
plperl_return_next(sv);
}
PG_CATCH();
{
ErrorData *edata;
/* Must reset elog.c's state */
MemoryContextSwitchTo(oldcontext);
edata = CopyErrorData();
FlushErrorState();
/* Punt the error to Perl */
croak_cstr(edata->message);
}
PG_END_TRY();
}
#line 60 "SPI.c"
#ifndef PERL_UNUSED_VAR
# define PERL_UNUSED_VAR(var) if (0) var = var
#endif
#ifndef dVAR
# define dVAR dNOOP
#endif
/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
# define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
# define PERL_DECIMAL_VERSION \
PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
# define PERL_VERSION_GE(r,v,s) \
(PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
# define PERL_VERSION_LE(r,v,s) \
(PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif
/* XS_INTERNAL is the explicit static-linkage variant of the default
* XS macro.
*
* XS_EXTERNAL is the same as XS_INTERNAL except it does not include
* "STATIC", ie. it exports XSUB symbols. You probably don't want that
* for anything but the BOOT XSUB.
*
* See XSUB.h in core!
*/
/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
# undef XS_EXTERNAL
# undef XS_INTERNAL
# if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
# define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
# define XS_INTERNAL(name) STATIC XSPROTO(name)
# endif
# if defined(__SYMBIAN32__)
# define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
# define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
# endif
# ifndef XS_EXTERNAL
# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
# define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
# define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
# else
# ifdef __cplusplus
# define XS_EXTERNAL(name) extern "C" XSPROTO(name)
# define XS_INTERNAL(name) static XSPROTO(name)
# else
# define XS_EXTERNAL(name) XSPROTO(name)
# define XS_INTERNAL(name) STATIC XSPROTO(name)
# endif
# endif
# endif
#endif
/* perl >= 5.10.0 && perl <= 5.15.1 */
/* The XS_EXTERNAL macro is used for functions that must not be static
* like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
* macro defined, the best we can do is assume XS is the same.
* Dito for XS_INTERNAL.
*/
#ifndef XS_EXTERNAL
# define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
# define XS_INTERNAL(name) XS(name)
#endif
/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
* internal macro that we're free to redefine for varying linkage due
* to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
* XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
*/
#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
# define XS_EUPXS(name) XS_EXTERNAL(name)
#else
/* default to internal */
# define XS_EUPXS(name) XS_INTERNAL(name)
#endif
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
const GV *const gv = CvGV(cv);
PERL_ARGS_ASSERT_CROAK_XS_USAGE;
if (gv) {
const char *const gvname = GvNAME(gv);
const HV *const stash = GvSTASH(gv);
const char *const hvname = stash ? HvNAME(stash) : NULL;
if (hvname)
Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
else
Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
} else {
/* Pants. I don't think that it should be possible to get here. */
Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
}
}
#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define croak_xs_usage S_croak_xs_usage
#endif
/* NOTE: the prototype of newXSproto() is different in versions of perls,
* so we define a portable version of newXSproto()
*/
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */
#if PERL_VERSION_LE(5, 21, 5)
# define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
# define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif
#line 204 "SPI.c"
XS_EUPXS(XS__spi_exec_query); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__spi_exec_query)
{
dVAR; dXSARGS;
if (items < 1)
croak_xs_usage(cv, "sv, ...");
{
SV* sv = ST(0)
;
#line 59 "SPI.xs"
HV *ret_hash;
int limit = 0;
char *query;
#line 219 "SPI.c"
SV * RETVAL;
#line 63 "SPI.xs"
if (items > 2)
croak("Usage: spi_exec_query(query, limit) "
"or spi_exec_query(query)");
if (items == 2)
limit = SvIV(ST(1));
query = sv2cstr(sv);
ret_hash = plperl_spi_exec(query, limit);
pfree(query);
RETVAL = newRV_noinc((SV*) ret_hash);
#line 231 "SPI.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__return_next); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__return_next)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "rv");
{
SV * rv = ST(0)
;
#line 79 "SPI.xs"
do_plperl_return_next(rv);
#line 250 "SPI.c"
}
XSRETURN_EMPTY;
}
XS_EUPXS(XS__spi_query); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__spi_query)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "sv");
{
SV * sv = ST(0)
;
SV * RETVAL;
#line 85 "SPI.xs"
char* query = sv2cstr(sv);
RETVAL = plperl_spi_query(query);
pfree(query);
#line 270 "SPI.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__spi_fetchrow); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__spi_fetchrow)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "sv");
{
SV* sv = ST(0)
;
SV * RETVAL;
#line 95 "SPI.xs"
char* cursor = sv2cstr(sv);
RETVAL = plperl_spi_fetchrow(cursor);
pfree(cursor);
#line 292 "SPI.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__spi_prepare); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__spi_prepare)
{
dVAR; dXSARGS;
if (items < 1)
croak_xs_usage(cv, "sv, ...");
{
SV* sv = ST(0)
;
SV * RETVAL;
#line 105 "SPI.xs"
int i;
SV** argv;
char* query = sv2cstr(sv);
if (items < 1)
Perl_croak(aTHX_ "Usage: spi_prepare(query, ...)");
argv = ( SV**) palloc(( items - 1) * sizeof(SV*));
for ( i = 1; i < items; i++)
argv[i - 1] = ST(i);
RETVAL = plperl_spi_prepare(query, items - 1, argv);
pfree( argv);
pfree(query);
#line 322 "SPI.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__spi_exec_prepared); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__spi_exec_prepared)
{
dVAR; dXSARGS;
if (items < 1)
croak_xs_usage(cv, "sv, ...");
{
SV* sv = ST(0)
;
#line 123 "SPI.xs"
HV *ret_hash;
#line 341 "SPI.c"
SV * RETVAL;
#line 125 "SPI.xs"
HV *attr = NULL;
int i, offset = 1, argc;
SV ** argv;
char *query = sv2cstr(sv);
if ( items < 1)
Perl_croak(aTHX_ "Usage: spi_exec_prepared(query, [\\%%attr,] "
"[\\@bind_values])");
if ( items > 1 && SvROK( ST( 1)) && SvTYPE( SvRV( ST( 1))) == SVt_PVHV)
{
attr = ( HV*) SvRV(ST(1));
offset++;
}
argc = items - offset;
argv = ( SV**) palloc( argc * sizeof(SV*));
for ( i = 0; offset < items; offset++, i++)
argv[i] = ST(offset);
ret_hash = plperl_spi_exec_prepared(query, attr, argc, argv);
RETVAL = newRV_noinc((SV*)ret_hash);
pfree( argv);
pfree(query);
#line 364 "SPI.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__spi_query_prepared); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__spi_query_prepared)
{
dVAR; dXSARGS;
if (items < 1)
croak_xs_usage(cv, "sv, ...");
{
SV * sv = ST(0)
;
SV * RETVAL;
#line 152 "SPI.xs"
int i;
SV ** argv;
char *query = sv2cstr(sv);
if ( items < 1)
Perl_croak(aTHX_ "Usage: spi_query_prepared(query, "
"[\\@bind_values])");
argv = ( SV**) palloc(( items - 1) * sizeof(SV*));
for ( i = 1; i < items; i++)
argv[i - 1] = ST(i);
RETVAL = plperl_spi_query_prepared(query, items - 1, argv);
pfree( argv);
pfree(query);
#line 395 "SPI.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__spi_freeplan); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__spi_freeplan)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "sv");
{
SV * sv = ST(0)
;
#line 171 "SPI.xs"
char *query = sv2cstr(sv);
plperl_spi_freeplan(query);
pfree(query);
#line 416 "SPI.c"
}
XSRETURN_EMPTY;
}
XS_EUPXS(XS__spi_cursor_close); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__spi_cursor_close)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "sv");
{
SV * sv = ST(0)
;
#line 179 "SPI.xs"
char *cursor = sv2cstr(sv);
plperl_spi_cursor_close(cursor);
pfree(cursor);
#line 435 "SPI.c"
}
XSRETURN_EMPTY;
}
#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_PostgreSQL__InServer__SPI); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_PostgreSQL__InServer__SPI)
{
#if PERL_VERSION_LE(5, 21, 5)
dVAR; dXSARGS;
#else
dVAR; dXSBOOTARGSAPIVERCHK;
#endif
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
char* file = __FILE__;
#else
const char* file = __FILE__;
#endif
PERL_UNUSED_VAR(file);
PERL_UNUSED_VAR(cv); /* -W */
PERL_UNUSED_VAR(items); /* -W */
#if PERL_VERSION_LE(5, 21, 5) && defined(XS_APIVERSION_BOOTCHECK)
XS_APIVERSION_BOOTCHECK;
#endif
(void)newXSproto_portable("spi_exec_query", XS__spi_exec_query, file, "$;@");
(void)newXSproto_portable("return_next", XS__return_next, file, "$");
(void)newXSproto_portable("spi_query", XS__spi_query, file, "$");
(void)newXSproto_portable("spi_fetchrow", XS__spi_fetchrow, file, "$");
(void)newXSproto_portable("spi_prepare", XS__spi_prepare, file, "$;@");
(void)newXSproto_portable("spi_exec_prepared", XS__spi_exec_prepared, file, "$;@");
(void)newXSproto_portable("spi_query_prepared", XS__spi_query_prepared, file, "$;@");
(void)newXSproto_portable("spi_freeplan", XS__spi_freeplan, file, "$");
(void)newXSproto_portable("spi_cursor_close", XS__spi_cursor_close, file, "$");
/* Initialisation Section */
#line 185 "SPI.xs"
items = 0; /* avoid 'unused variable' warning */
#line 480 "SPI.c"
/* End of Initialisation Section */
#if PERL_VERSION_LE(5, 21, 5)
# if PERL_VERSION_GE(5, 9, 0)
if (PL_unitcheckav)
call_list(PL_scopestack_ix, PL_unitcheckav);
# endif
XSRETURN_YES;
#else
Perl_xs_boot_epilog(aTHX_ ax);
#endif
}
/*
* This file was generated automatically by ExtUtils::ParseXS version 3.34 from the
* contents of Util.xs. Do not edit this file, edit Util.xs instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
#line 1 "Util.xs"
/**********************************************************************
* PostgreSQL::InServer::Util
*
* src/pl/plperl/Util.xs
*
* Defines plperl interfaces for general-purpose utilities.
* This module is bootstrapped as soon as an interpreter is initialized.
* Currently doesn't define a PACKAGE= so all subs are in main:: to avoid
* the need for explicit importing.
*
**********************************************************************/
/* this must be first: */
#include "postgres.h"
#include "fmgr.h"
#include "utils/builtins.h"
#include "utils/bytea.h" /* for byteain & byteaout */
#include "mb/pg_wchar.h" /* for GetDatabaseEncoding */
/* Defined by Perl */
#undef _
/* perl stuff */
#include "plperl.h"
#include "plperl_helpers.h"
/*
* Implementation of plperl's elog() function
*
* If the error level is less than ERROR, we'll just emit the message and
* return. When it is ERROR, elog() will longjmp, which we catch and
* turn into a Perl croak(). Note we are assuming that elog() can't have
* any internal failures that are so bad as to require a transaction abort.
*
* This is out-of-line to suppress "might be clobbered by longjmp" warnings.
*/
static void
do_util_elog(int level, SV *msg)
{
MemoryContext oldcontext = CurrentMemoryContext;
char * volatile cmsg = NULL;
PG_TRY();
{
cmsg = sv2cstr(msg);
elog(level, "%s", cmsg);
pfree(cmsg);
}
PG_CATCH();
{
ErrorData *edata;
/* Must reset elog.c's state */
MemoryContextSwitchTo(oldcontext);
edata = CopyErrorData();
FlushErrorState();
if (cmsg)
pfree(cmsg);
/* Punt the error to Perl */
croak_cstr(edata->message);
}
PG_END_TRY();
}
static text *
sv2text(SV *sv)
{
char *str = sv2cstr(sv);
text *text;
text = cstring_to_text(str);
pfree(str);
return text;
}
#line 87 "Util.c"
#ifndef PERL_UNUSED_VAR
# define PERL_UNUSED_VAR(var) if (0) var = var
#endif
#ifndef dVAR
# define dVAR dNOOP
#endif
/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
# define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
# define PERL_DECIMAL_VERSION \
PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
# define PERL_VERSION_GE(r,v,s) \
(PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
# define PERL_VERSION_LE(r,v,s) \
(PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif
/* XS_INTERNAL is the explicit static-linkage variant of the default
* XS macro.
*
* XS_EXTERNAL is the same as XS_INTERNAL except it does not include
* "STATIC", ie. it exports XSUB symbols. You probably don't want that
* for anything but the BOOT XSUB.
*
* See XSUB.h in core!
*/
/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
# undef XS_EXTERNAL
# undef XS_INTERNAL
# if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
# define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
# define XS_INTERNAL(name) STATIC XSPROTO(name)
# endif
# if defined(__SYMBIAN32__)
# define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
# define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
# endif
# ifndef XS_EXTERNAL
# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
# define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
# define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
# else
# ifdef __cplusplus
# define XS_EXTERNAL(name) extern "C" XSPROTO(name)
# define XS_INTERNAL(name) static XSPROTO(name)
# else
# define XS_EXTERNAL(name) XSPROTO(name)
# define XS_INTERNAL(name) STATIC XSPROTO(name)
# endif
# endif
# endif
#endif
/* perl >= 5.10.0 && perl <= 5.15.1 */
/* The XS_EXTERNAL macro is used for functions that must not be static
* like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
* macro defined, the best we can do is assume XS is the same.
* Dito for XS_INTERNAL.
*/
#ifndef XS_EXTERNAL
# define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
# define XS_INTERNAL(name) XS(name)
#endif
/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
* internal macro that we're free to redefine for varying linkage due
* to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
* XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
*/
#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
# define XS_EUPXS(name) XS_EXTERNAL(name)
#else
/* default to internal */
# define XS_EUPXS(name) XS_INTERNAL(name)
#endif
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
const GV *const gv = CvGV(cv);
PERL_ARGS_ASSERT_CROAK_XS_USAGE;
if (gv) {
const char *const gvname = GvNAME(gv);
const HV *const stash = GvSTASH(gv);
const char *const hvname = stash ? HvNAME(stash) : NULL;
if (hvname)
Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
else
Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
} else {
/* Pants. I don't think that it should be possible to get here. */
Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
}
}
#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define croak_xs_usage S_croak_xs_usage
#endif
/* NOTE: the prototype of newXSproto() is different in versions of perls,
* so we define a portable version of newXSproto()
*/
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */
#if PERL_VERSION_LE(5, 21, 5)
# define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
# define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif
#line 231 "Util.c"
XS_EUPXS(XS___aliased_constants); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS___aliased_constants)
{
dVAR; dXSARGS;
dXSI32;
if (items != 0)
croak_xs_usage(cv, "");
{
int RETVAL;
dXSTARG;
#line 93 "Util.xs"
/* uses the ALIAS value as the return value */
RETVAL = ix;
#line 246 "Util.c"
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
XS_EUPXS(XS__elog); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__elog)
{
dVAR; dXSARGS;
if (items != 2)
croak_xs_usage(cv, "level, msg");
{
int level = (int)SvIV(ST(0))
;
SV * msg = ST(1)
;
#line 104 "Util.xs"
if (level > ERROR) /* no PANIC allowed thanks */
level = ERROR;
if (level < DEBUG5)
level = DEBUG5;
do_util_elog(level, msg);
#line 270 "Util.c"
}
XSRETURN_EMPTY;
}
XS_EUPXS(XS__quote_literal); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__quote_literal)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "sv");
{
SV * sv = ST(0)
;
SV * RETVAL;
#line 114 "Util.xs"
if (!sv || !SvOK(sv)) {
RETVAL = &PL_sv_undef;
}
else {
text *arg = sv2text(sv);
text *quoted = DatumGetTextPP(DirectFunctionCall1(quote_literal, PointerGetDatum(arg)));
char *str;
pfree(arg);
str = text_to_cstring(quoted);
RETVAL = cstr2sv(str);
pfree(str);
}
#line 300 "Util.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__quote_nullable); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__quote_nullable)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "sv");
{
SV * sv = ST(0)
;
SV * RETVAL;
#line 134 "Util.xs"
if (!sv || !SvOK(sv))
{
RETVAL = cstr2sv("NULL");
}
else
{
text *arg = sv2text(sv);
text *quoted = DatumGetTextPP(DirectFunctionCall1(quote_nullable, PointerGetDatum(arg)));
char *str;
pfree(arg);
str = text_to_cstring(quoted);
RETVAL = cstr2sv(str);
pfree(str);
}
#line 334 "Util.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__quote_ident); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__quote_ident)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "sv");
{
SV * sv = ST(0)
;
#line 156 "Util.xs"
text *arg;
text *quoted;
char *str;
#line 355 "Util.c"
SV * RETVAL;
#line 160 "Util.xs"
arg = sv2text(sv);
quoted = DatumGetTextPP(DirectFunctionCall1(quote_ident, PointerGetDatum(arg)));
pfree(arg);
str = text_to_cstring(quoted);
RETVAL = cstr2sv(str);
pfree(str);
#line 365 "Util.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__decode_bytea); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__decode_bytea)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "sv");
{
SV * sv = ST(0)
;
#line 174 "Util.xs"
char *arg;
text *ret;
#line 385 "Util.c"
SV * RETVAL;
#line 177 "Util.xs"
arg = SvPVbyte_nolen(sv);
ret = DatumGetTextPP(DirectFunctionCall1(byteain, PointerGetDatum(arg)));
/* not cstr2sv because this is raw bytes not utf8'able */
RETVAL = newSVpvn(VARDATA_ANY(ret), VARSIZE_ANY_EXHDR(ret));
#line 392 "Util.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__encode_bytea); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__encode_bytea)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "sv");
{
SV * sv = ST(0)
;
#line 188 "Util.xs"
text *arg;
char *ret;
STRLEN len;
#line 413 "Util.c"
SV * RETVAL;
#line 192 "Util.xs"
/* not sv2text because this is raw bytes not utf8'able */
ret = SvPVbyte(sv, len);
arg = cstring_to_text_with_len(ret, len);
ret = DatumGetCString(DirectFunctionCall1(byteaout, PointerGetDatum(arg)));
RETVAL = cstr2sv(ret);
#line 421 "Util.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__looks_like_number); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__looks_like_number)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "sv");
{
SV * sv = ST(0)
;
SV * RETVAL;
#line 204 "Util.xs"
if (!SvOK(sv))
RETVAL = &PL_sv_undef;
else if ( looks_like_number(sv) )
RETVAL = &PL_sv_yes;
else
RETVAL = &PL_sv_no;
#line 446 "Util.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
XS_EUPXS(XS__encode_typed_literal); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS__encode_typed_literal)
{
dVAR; dXSARGS;
if (items != 2)
croak_xs_usage(cv, "sv, typname");
{
SV * sv = ST(0)
;
char * typname = (char *)SvPV_nolen(ST(1))
;
#line 218 "Util.xs"
char *outstr;
#line 467 "Util.c"
SV * RETVAL;
#line 220 "Util.xs"
outstr = plperl_sv_to_literal(sv, typname);
if (outstr == NULL)
RETVAL = &PL_sv_undef;
else
RETVAL = cstr2sv(outstr);
#line 475 "Util.c"
RETVAL = sv_2mortal(RETVAL);
ST(0) = RETVAL;
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_PostgreSQL__InServer__Util); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_PostgreSQL__InServer__Util)
{
#if PERL_VERSION_LE(5, 21, 5)
dVAR; dXSARGS;
#else
dVAR; dXSBOOTARGSAPIVERCHK;
#endif
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
char* file = __FILE__;
#else
const char* file = __FILE__;
#endif
PERL_UNUSED_VAR(file);
PERL_UNUSED_VAR(cv); /* -W */
PERL_UNUSED_VAR(items); /* -W */
#if PERL_VERSION_LE(5, 21, 5) && defined(XS_APIVERSION_BOOTCHECK)
XS_APIVERSION_BOOTCHECK;
#endif
cv = newXSproto_portable("DEBUG", XS___aliased_constants, file, "");
XSANY.any_i32 = DEBUG2;
cv = newXSproto_portable("ERROR", XS___aliased_constants, file, "");
XSANY.any_i32 = ERROR;
cv = newXSproto_portable("INFO", XS___aliased_constants, file, "");
XSANY.any_i32 = INFO;
cv = newXSproto_portable("LOG", XS___aliased_constants, file, "");
XSANY.any_i32 = LOG;
cv = newXSproto_portable("NOTICE", XS___aliased_constants, file, "");
XSANY.any_i32 = NOTICE;
cv = newXSproto_portable("WARNING", XS___aliased_constants, file, "");
XSANY.any_i32 = WARNING;
cv = newXSproto_portable("_aliased_constants", XS___aliased_constants, file, "");
XSANY.any_i32 = 0;
(void)newXSproto_portable("elog", XS__elog, file, "$$");
(void)newXSproto_portable("quote_literal", XS__quote_literal, file, "$");
(void)newXSproto_portable("quote_nullable", XS__quote_nullable, file, "$");
(void)newXSproto_portable("quote_ident", XS__quote_ident, file, "$");
(void)newXSproto_portable("decode_bytea", XS__decode_bytea, file, "$");
(void)newXSproto_portable("encode_bytea", XS__encode_bytea, file, "$");
(void)newXSproto_portable("looks_like_number", XS__looks_like_number, file, "$");
(void)newXSproto_portable("encode_typed_literal", XS__encode_typed_literal, file, "$$");
/* Initialisation Section */
#line 229 "Util.xs"
items = 0; /* avoid 'unused variable' warning */
#line 535 "Util.c"
/* End of Initialisation Section */
#if PERL_VERSION_LE(5, 21, 5)
# if PERL_VERSION_GE(5, 9, 0)
if (PL_unitcheckav)
call_list(PL_scopestack_ix, PL_unitcheckav);
# endif
XSRETURN_YES;
#else
Perl_xs_boot_epilog(aTHX_ ax);
#endif
}
#define PLPERL_SET_OPMASK(opmask) \
memset(opmask, 1, MAXO); /* disable all */ \
/* then allow some... */ \
/* ALLOWED: :default :base_math !:base_io sort time require entereval caller dofile print prtf !dbmopen !setpgrp !setpriority !custom */ \
opmask[OP_NULL ] = 0; /* null operation */ \
opmask[OP_STUB ] = 0; /* stub */ \
opmask[OP_SCALAR ] = 0; /* scalar */ \
opmask[OP_PUSHMARK ] = 0; /* pushmark */ \
opmask[OP_WANTARRAY ] = 0; /* wantarray */ \
opmask[OP_CONST ] = 0; /* constant item */ \
opmask[OP_GVSV ] = 0; /* scalar variable */ \
opmask[OP_GV ] = 0; /* glob value */ \
opmask[OP_GELEM ] = 0; /* glob elem */ \
opmask[OP_PADSV ] = 0; /* private variable */ \
opmask[OP_PADAV ] = 0; /* private array */ \
opmask[OP_PADHV ] = 0; /* private hash */ \
opmask[OP_PADANY ] = 0; /* private value */ \
opmask[OP_RV2GV ] = 0; /* ref-to-glob cast */ \
opmask[OP_RV2SV ] = 0; /* scalar dereference */ \
opmask[OP_AV2ARYLEN ] = 0; /* array length */ \
opmask[OP_RV2CV ] = 0; /* subroutine dereference */ \
opmask[OP_ANONCODE ] = 0; /* anonymous subroutine */ \
opmask[OP_PROTOTYPE ] = 0; /* subroutine prototype */ \
opmask[OP_REFGEN ] = 0; /* reference constructor */ \
opmask[OP_SREFGEN ] = 0; /* single ref constructor */ \
opmask[OP_REF ] = 0; /* reference-type operator */ \
opmask[OP_BLESS ] = 0; /* bless */ \
opmask[OP_REGCMAYBE ] = 0; /* regexp internal guard */ \
opmask[OP_REGCRESET ] = 0; /* regexp internal reset */ \
opmask[OP_REGCOMP ] = 0; /* regexp compilation */ \
opmask[OP_MATCH ] = 0; /* pattern match (m//) */ \
opmask[OP_QR ] = 0; /* pattern quote (qr//) */ \
opmask[OP_SUBST ] = 0; /* substitution (s///) */ \
opmask[OP_SUBSTCONT ] = 0; /* substitution iterator */ \
opmask[OP_TRANS ] = 0; /* transliteration (tr///) */ \
opmask[OP_TRANSR ] = 0; /* transliteration (tr///) */ \
opmask[OP_SASSIGN ] = 0; /* scalar assignment */ \
opmask[OP_AASSIGN ] = 0; /* list assignment */ \
opmask[OP_CHOP ] = 0; /* chop */ \
opmask[OP_SCHOP ] = 0; /* scalar chop */ \
opmask[OP_CHOMP ] = 0; /* chomp */ \
opmask[OP_SCHOMP ] = 0; /* scalar chomp */ \
opmask[OP_DEFINED ] = 0; /* defined operator */ \
opmask[OP_UNDEF ] = 0; /* undef operator */ \
opmask[OP_STUDY ] = 0; /* study */ \
opmask[OP_POS ] = 0; /* match position */ \
opmask[OP_PREINC ] = 0; /* preincrement (++) */ \
opmask[OP_I_PREINC ] = 0; /* integer preincrement (++) */ \
opmask[OP_PREDEC ] = 0; /* predecrement (--) */ \
opmask[OP_I_PREDEC ] = 0; /* integer predecrement (--) */ \
opmask[OP_POSTINC ] = 0; /* postincrement (++) */ \
opmask[OP_I_POSTINC ] = 0; /* integer postincrement (++) */ \
opmask[OP_POSTDEC ] = 0; /* postdecrement (--) */ \
opmask[OP_I_POSTDEC ] = 0; /* integer postdecrement (--) */ \
opmask[OP_POW ] = 0; /* exponentiation (**) */ \
opmask[OP_MULTIPLY ] = 0; /* multiplication (*) */ \
opmask[OP_I_MULTIPLY ] = 0; /* integer multiplication (*) */ \
opmask[OP_DIVIDE ] = 0; /* division (/) */ \
opmask[OP_I_DIVIDE ] = 0; /* integer division (/) */ \
opmask[OP_MODULO ] = 0; /* modulus (%) */ \
opmask[OP_I_MODULO ] = 0; /* integer modulus (%) */ \
opmask[OP_REPEAT ] = 0; /* repeat (x) */ \
opmask[OP_ADD ] = 0; /* addition (+) */ \
opmask[OP_I_ADD ] = 0; /* integer addition (+) */ \
opmask[OP_SUBTRACT ] = 0; /* subtraction (-) */ \
opmask[OP_I_SUBTRACT ] = 0; /* integer subtraction (-) */ \
opmask[OP_CONCAT ] = 0; /* concatenation (.) or string */ \
opmask[OP_STRINGIFY ] = 0; /* string */ \
opmask[OP_LEFT_SHIFT ] = 0; /* left bitshift (<<) */ \
opmask[OP_RIGHT_SHIFT ] = 0; /* right bitshift (>>) */ \
opmask[OP_LT ] = 0; /* numeric lt (<) */ \
opmask[OP_I_LT ] = 0; /* integer lt (<) */ \
opmask[OP_GT ] = 0; /* numeric gt (>) */ \
opmask[OP_I_GT ] = 0; /* integer gt (>) */ \
opmask[OP_LE ] = 0; /* numeric le (<=) */ \
opmask[OP_I_LE ] = 0; /* integer le (<=) */ \
opmask[OP_GE ] = 0; /* numeric ge (>=) */ \
opmask[OP_I_GE ] = 0; /* integer ge (>=) */ \
opmask[OP_EQ ] = 0; /* numeric eq (==) */ \
opmask[OP_I_EQ ] = 0; /* integer eq (==) */ \
opmask[OP_NE ] = 0; /* numeric ne (!=) */ \
opmask[OP_I_NE ] = 0; /* integer ne (!=) */ \
opmask[OP_NCMP ] = 0; /* numeric comparison (<=>) */ \
opmask[OP_I_NCMP ] = 0; /* integer comparison (<=>) */ \
opmask[OP_SLT ] = 0; /* string lt */ \
opmask[OP_SGT ] = 0; /* string gt */ \
opmask[OP_SLE ] = 0; /* string le */ \
opmask[OP_SGE ] = 0; /* string ge */ \
opmask[OP_SEQ ] = 0; /* string eq */ \
opmask[OP_SNE ] = 0; /* string ne */ \
opmask[OP_SCMP ] = 0; /* string comparison (cmp) */ \
opmask[OP_BIT_AND ] = 0; /* bitwise and (&) */ \
opmask[OP_BIT_XOR ] = 0; /* bitwise xor (^) */ \
opmask[OP_BIT_OR ] = 0; /* bitwise or (|) */ \
opmask[OP_NBIT_AND ] = 0; /* numeric bitwise and (&) */ \
opmask[OP_NBIT_XOR ] = 0; /* numeric bitwise xor (^) */ \
opmask[OP_NBIT_OR ] = 0; /* numeric bitwise or (|) */ \
opmask[OP_SBIT_AND ] = 0; /* string bitwise and (&.) */ \
opmask[OP_SBIT_XOR ] = 0; /* string bitwise xor (^.) */ \
opmask[OP_SBIT_OR ] = 0; /* string bitwise or (|.) */ \
opmask[OP_NEGATE ] = 0; /* negation (-) */ \
opmask[OP_I_NEGATE ] = 0; /* integer negation (-) */ \
opmask[OP_NOT ] = 0; /* not */ \
opmask[OP_COMPLEMENT ] = 0; /* 1's complement (~) */ \
opmask[OP_NCOMPLEMENT ] = 0; /* numeric 1's complement (~) */ \
opmask[OP_SCOMPLEMENT ] = 0; /* string 1's complement (~) */ \
opmask[OP_SMARTMATCH ] = 0; /* smart match */ \
opmask[OP_ATAN2 ] = 0; /* atan2 */ \
opmask[OP_SIN ] = 0; /* sin */ \
opmask[OP_COS ] = 0; /* cos */ \
opmask[OP_RAND ] = 0; /* rand */ \
opmask[OP_SRAND ] = 0; /* srand */ \
opmask[OP_EXP ] = 0; /* exp */ \
opmask[OP_LOG ] = 0; /* log */ \
opmask[OP_SQRT ] = 0; /* sqrt */ \
opmask[OP_INT ] = 0; /* int */ \
opmask[OP_HEX ] = 0; /* hex */ \
opmask[OP_OCT ] = 0; /* oct */ \
opmask[OP_ABS ] = 0; /* abs */ \
opmask[OP_LENGTH ] = 0; /* length */ \
opmask[OP_SUBSTR ] = 0; /* substr */ \
opmask[OP_VEC ] = 0; /* vec */ \
opmask[OP_INDEX ] = 0; /* index */ \
opmask[OP_RINDEX ] = 0; /* rindex */ \
opmask[OP_SPRINTF ] = 0; /* sprintf */ \
opmask[OP_ORD ] = 0; /* ord */ \
opmask[OP_CHR ] = 0; /* chr */ \
opmask[OP_CRYPT ] = 0; /* crypt */ \
opmask[OP_UCFIRST ] = 0; /* ucfirst */ \
opmask[OP_LCFIRST ] = 0; /* lcfirst */ \
opmask[OP_UC ] = 0; /* uc */ \
opmask[OP_LC ] = 0; /* lc */ \
opmask[OP_QUOTEMETA ] = 0; /* quotemeta */ \
opmask[OP_RV2AV ] = 0; /* array dereference */ \
opmask[OP_AELEMFAST ] = 0; /* constant array element */ \
opmask[OP_AELEMFAST_LEX] = 0; /* constant lexical array element */ \
opmask[OP_AELEM ] = 0; /* array element */ \
opmask[OP_ASLICE ] = 0; /* array slice */ \
opmask[OP_KVASLICE ] = 0; /* index/value array slice */ \
opmask[OP_AEACH ] = 0; /* each on array */ \
opmask[OP_AVALUES ] = 0; /* values on array */ \
opmask[OP_AKEYS ] = 0; /* keys on array */ \
opmask[OP_EACH ] = 0; /* each */ \
opmask[OP_VALUES ] = 0; /* values */ \
opmask[OP_KEYS ] = 0; /* keys */ \
opmask[OP_DELETE ] = 0; /* delete */ \
opmask[OP_EXISTS ] = 0; /* exists */ \
opmask[OP_RV2HV ] = 0; /* hash dereference */ \
opmask[OP_HELEM ] = 0; /* hash element */ \
opmask[OP_HSLICE ] = 0; /* hash slice */ \
opmask[OP_KVHSLICE ] = 0; /* key/value hash slice */ \
opmask[OP_MULTIDEREF ] = 0; /* array or hash lookup */ \
opmask[OP_SPLIT ] = 0; /* split */ \
opmask[OP_JOIN ] = 0; /* join or string */ \
opmask[OP_LIST ] = 0; /* list */ \
opmask[OP_LSLICE ] = 0; /* list slice */ \
opmask[OP_ANONLIST ] = 0; /* anonymous array ([]) */ \
opmask[OP_ANONHASH ] = 0; /* anonymous hash ({}) */ \
opmask[OP_SPLICE ] = 0; /* splice */ \
opmask[OP_PUSH ] = 0; /* push */ \
opmask[OP_POP ] = 0; /* pop */ \
opmask[OP_SHIFT ] = 0; /* shift */ \
opmask[OP_UNSHIFT ] = 0; /* unshift */ \
opmask[OP_SORT ] = 0; /* sort */ \
opmask[OP_REVERSE ] = 0; /* reverse */ \
opmask[OP_GREPSTART ] = 0; /* grep */ \
opmask[OP_GREPWHILE ] = 0; /* grep iterator */ \
opmask[OP_MAPSTART ] = 0; /* map */ \
opmask[OP_MAPWHILE ] = 0; /* map iterator */ \
opmask[OP_RANGE ] = 0; /* flipflop */ \
opmask[OP_FLIP ] = 0; /* range (or flip) */ \
opmask[OP_FLOP ] = 0; /* range (or flop) */ \
opmask[OP_AND ] = 0; /* logical and (&&) */ \
opmask[OP_OR ] = 0; /* logical or (||) */ \
opmask[OP_XOR ] = 0; /* logical xor */ \
opmask[OP_DOR ] = 0; /* defined or (//) */ \
opmask[OP_COND_EXPR ] = 0; /* conditional expression */ \
opmask[OP_ANDASSIGN ] = 0; /* logical and assignment (&&=) */ \
opmask[OP_ORASSIGN ] = 0; /* logical or assignment (||=) */ \
opmask[OP_DORASSIGN ] = 0; /* defined or assignment (//=) */ \
opmask[OP_METHOD ] = 0; /* method lookup */ \
opmask[OP_ENTERSUB ] = 0; /* subroutine entry */ \
opmask[OP_LEAVESUB ] = 0; /* subroutine exit */ \
opmask[OP_LEAVESUBLV ] = 0; /* lvalue subroutine return */ \
opmask[OP_ARGCHECK ] = 0; /* check subroutine arguments */ \
opmask[OP_ARGELEM ] = 0; /* subroutine argument */ \
opmask[OP_ARGDEFELEM ] = 0; /* subroutine argument default value */ \
opmask[OP_CALLER ] = 0; /* caller */ \
opmask[OP_WARN ] = 0; /* warn */ \
opmask[OP_DIE ] = 0; /* die */ \
opmask[OP_LINESEQ ] = 0; /* line sequence */ \
opmask[OP_NEXTSTATE ] = 0; /* next statement */ \
opmask[OP_UNSTACK ] = 0; /* iteration finalizer */ \
opmask[OP_ENTER ] = 0; /* block entry */ \
opmask[OP_LEAVE ] = 0; /* block exit */ \
opmask[OP_SCOPE ] = 0; /* block */ \
opmask[OP_ENTERITER ] = 0; /* foreach loop entry */ \
opmask[OP_ITER ] = 0; /* foreach loop iterator */ \
opmask[OP_ENTERLOOP ] = 0; /* loop entry */ \
opmask[OP_LEAVELOOP ] = 0; /* loop exit */ \
opmask[OP_RETURN ] = 0; /* return */ \
opmask[OP_LAST ] = 0; /* last */ \
opmask[OP_NEXT ] = 0; /* next */ \
opmask[OP_REDO ] = 0; /* redo */ \
opmask[OP_GOTO ] = 0; /* goto */ \
opmask[OP_METHOD_NAMED] = 0; /* method with known name */ \
opmask[OP_METHOD_SUPER] = 0; /* super with known name */ \
opmask[OP_METHOD_REDIR] = 0; /* redirect method with known name */ \
opmask[OP_METHOD_REDIR_SUPER] = 0; /* redirect super method with known name */ \
opmask[OP_ENTERGIVEN ] = 0; /* given() */ \
opmask[OP_LEAVEGIVEN ] = 0; /* leave given block */ \
opmask[OP_ENTERWHEN ] = 0; /* when() */ \
opmask[OP_LEAVEWHEN ] = 0; /* leave when block */ \
opmask[OP_BREAK ] = 0; /* break */ \
opmask[OP_CONTINUE ] = 0; /* continue */ \
opmask[OP_PIPE_OP ] = 0; /* pipe */ \
opmask[OP_TIE ] = 0; /* tie */ \
opmask[OP_UNTIE ] = 0; /* untie */ \
opmask[OP_DBMCLOSE ] = 0; /* dbmclose */ \
opmask[OP_SSELECT ] = 0; /* select system call */ \
opmask[OP_SELECT ] = 0; /* select */ \
opmask[OP_PRTF ] = 0; /* printf */ \
opmask[OP_PRINT ] = 0; /* print */ \
opmask[OP_SOCKPAIR ] = 0; /* socketpair */ \
opmask[OP_GETPPID ] = 0; /* getppid */ \
opmask[OP_GETPGRP ] = 0; /* getpgrp */ \
opmask[OP_GETPRIORITY ] = 0; /* getpriority */ \
opmask[OP_TIME ] = 0; /* time */ \
opmask[OP_LOCALTIME ] = 0; /* localtime */ \
opmask[OP_GMTIME ] = 0; /* gmtime */ \
opmask[OP_REQUIRE ] = 0; /* require */ \
opmask[OP_DOFILE ] = 0; /* do "file" */ \
opmask[OP_ENTEREVAL ] = 0; /* eval "string" */ \
opmask[OP_LEAVEEVAL ] = 0; /* eval "string" exit */ \
opmask[OP_ENTERTRY ] = 0; /* eval {block} */ \
opmask[OP_LEAVETRY ] = 0; /* eval {block} exit */ \
opmask[OP_LOCK ] = 0; /* lock */ \
opmask[OP_ONCE ] = 0; /* once */ \
opmask[OP_COREARGS ] = 0; /* CORE:: subroutine */ \
opmask[OP_AVHVSWITCH ] = 0; /* Array/hash switch */ \
opmask[OP_FC ] = 0; /* fc */ \
opmask[OP_PADCV ] = 0; /* private subroutine */ \
opmask[OP_INTROCV ] = 0; /* private subroutine */ \
opmask[OP_CLONECV ] = 0; /* private subroutine */ \
opmask[OP_PADRANGE ] = 0; /* list of private variables */ \
opmask[OP_REFASSIGN ] = 0; /* lvalue ref assignment */ \
opmask[OP_LVREF ] = 0; /* lvalue ref assignment */ \
opmask[OP_LVREFSLICE ] = 0; /* lvalue ref assignment */ \
opmask[OP_LVAVREF ] = 0; /* lvalue array reference */ \
opmask[OP_ANONCONST ] = 0; /* anonymous constant */ \
/* end */
/*
* DO NOT EDIT - THIS FILE IS AUTOGENERATED - CHANGES WILL BE LOST
* Written by ./text2macro.pl from plc_perlboot.pl plc_trusted.pl
*/
#define PLC_PERLBOOT \
"use strict;\n" \
"use 5.008001;\n" \
"use vars qw(%_SHARED $_TD);\n" \
"PostgreSQL::InServer::Util::bootstrap();\n" \
"sub ::is_array_ref\n" \
"{\n" \
" return ref($_[0]) =~ m/^(?:PostgreSQL::InServer::)?ARRAY$/;\n" \
"}\n" \
"sub ::encode_array_literal\n" \
"{\n" \
" my ($arg, $delim) = @_;\n" \
" return $arg unless (::is_array_ref($arg));\n" \
" $delim = ', ' unless defined $delim;\n" \
" my $res = '';\n" \
" foreach my $elem (@$arg)\n" \
" {\n" \
" $res .= $delim if length $res;\n" \
" if (ref $elem)\n" \
" {\n" \
" $res .= ::encode_array_literal($elem, $delim);\n" \
" }\n" \
" elsif (defined $elem)\n" \
" {\n" \
" (my $str = $elem) =~ s/([\"\\\\])/\\\\$1/g;\n" \
" $res .= qq(\"$str\");\n" \
" }\n" \
" else\n" \
" {\n" \
" $res .= 'NULL';\n" \
" }\n" \
" }\n" \
" return qq({$res});\n" \
"}\n" \
"sub ::encode_array_constructor\n" \
"{\n" \
" my $arg = shift;\n" \
" return ::quote_nullable($arg) unless ::is_array_ref($arg);\n" \
" my $res = join \", \",\n" \
" map { (ref $_) ? ::encode_array_constructor($_) : ::quote_nullable($_) }\n" \
" @$arg;\n" \
" return \"ARRAY[$res]\";\n" \
"}\n" \
"{\n" \
" package PostgreSQL::InServer\n" \
" ; ## no critic (RequireFilenameMatchesPackage);\n" \
" use strict;\n" \
" use warnings;\n" \
" sub plperl_warn\n" \
" {\n" \
" (my $msg = shift) =~ s/\\(eval \\d+\\) //g;\n" \
" chomp $msg;\n" \
" &::elog(&::WARNING, $msg);\n" \
" }\n" \
" $SIG{__WARN__} = \\&plperl_warn;\n" \
" sub plperl_die\n" \
" {\n" \
" (my $msg = shift) =~ s/\\(eval \\d+\\) //g;\n" \
" die $msg;\n" \
" }\n" \
" $SIG{__DIE__} = \\&plperl_die;\n" \
" sub mkfuncsrc\n" \
" {\n" \
" my ($name, $imports, $prolog, $src) = @_;\n" \
" my $BEGIN = join \"\\n\", map {\n" \
" my $names = $imports->{$_} || [];\n" \
" \"$_->import(qw(@$names));\"\n" \
" } sort keys %$imports;\n" \
" $BEGIN &&= \"BEGIN { $BEGIN }\";\n" \
" return qq[ package main; sub { $BEGIN $prolog $src } ];\n" \
" }\n" \
" sub mkfunc\n" \
" {\n" \
" ## no critic (ProhibitNoStrict, ProhibitStringyEval);\n" \
" no strict; # default to no strict for the eval\n" \
" no warnings; # default to no warnings for the eval\n" \
" my $ret = eval(mkfuncsrc(@_));\n" \
" $@ =~ s/\\(eval \\d+\\) //g if $@;\n" \
" return $ret;\n" \
" ## use critic\n" \
" }\n" \
" 1;\n" \
"}\n" \
"{\n" \
" package PostgreSQL::InServer::ARRAY;\n" \
" use strict;\n" \
" use warnings;\n" \
" use overload\n" \
" '\"\"' => \\&to_str,\n" \
" '@{}' => \\&to_arr;\n" \
" sub to_str\n" \
" {\n" \
" my $self = shift;\n" \
" return ::encode_typed_literal($self->{'array'}, $self->{'typeoid'});\n" \
" }\n" \
" sub to_arr\n" \
" {\n" \
" return shift->{'array'};\n" \
" }\n" \
" 1;\n" \
"}\n" \
""
#define PLC_TRUSTED \
"package PostgreSQL::InServer::safe\n" \
" ; ## no critic (RequireFilenameMatchesPackage);\n" \
"require strict;\n" \
"require Carp;\n" \
"require Carp::Heavy;\n" \
"require warnings;\n" \
"require feature if $] >= 5.010000;\n" \
""
/* end */
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers