Rearrange the handling of error context reports.

Remove the code in plpgsql that suppressed the innermost line of CONTEXT
for messages emitted by RAISE commands.  That was never more than a quick
backwards-compatibility hack, and it's pretty silly in cases where the
RAISE is nested in several levels of function.  What's more, it violated
our design theory that verbosity of error reports should be controlled
on the client side not the server side.

To alleviate the resulting noise increase, introduce a feature in libpq
and psql whereby the CONTEXT field of messages can be suppressed, either
always or only for non-error messages.  Printing CONTEXT for errors only
is now their default behavior.

The actual code changes here are pretty small, but the effects on the
regression test outputs are widespread.  I had to edit some of the
alternative expected outputs by hand; hopefully the buildfarm will soon
find anything I fat-fingered.

In passing, fix up (again) the output line counts in psql's various
help displays.  Add some commentary about how to verify them.

Pavel Stehule, reviewed by Petr Jelínek, Jeevan Chalke, and others
This commit is contained in:
Tom Lane 2015-09-05 11:58:20 -04:00
parent c80b5f66c6
commit 0426f349ef
48 changed files with 237 additions and 610 deletions

View File

@ -1,4 +1,6 @@
CREATE EXTENSION dblink;
-- want context for notices
\set SHOW_CONTEXT always
CREATE TABLE foo(f1 int, f2 text, f3 text[], primary key (f1,f2));
INSERT INTO foo VALUES (0,'a','{"a0","b0","c0"}');
INSERT INTO foo VALUES (1,'b','{"a1","b1","c1"}');

View File

@ -1,5 +1,8 @@
CREATE EXTENSION dblink;
-- want context for notices
\set SHOW_CONTEXT always
CREATE TABLE foo(f1 int, f2 text, f3 text[], primary key (f1,f2));
INSERT INTO foo VALUES (0,'a','{"a0","b0","c0"}');
INSERT INTO foo VALUES (1,'b','{"a1","b1","c1"}');

View File

@ -29,7 +29,6 @@ INFO: $VAR1 = {
'cc' => undef
};
CONTEXT: PL/Perl function "test1"
test1
-------
2
@ -46,7 +45,6 @@ $$;
SELECT test1none('aa=>bb, cc=>NULL'::hstore);
INFO: $VAR1 = '"aa"=>"bb", "cc"=>NULL';
CONTEXT: PL/Perl function "test1none"
test1none
-----------
0
@ -67,7 +65,6 @@ INFO: $VAR1 = {
'cc' => undef
};
CONTEXT: PL/Perl function "test1list"
test1list
-----------
2
@ -92,7 +89,6 @@ $VAR2 = {
'dd' => 'ee'
};
CONTEXT: PL/Perl function "test1arr"
test1arr
----------
2
@ -120,10 +116,8 @@ INFO: $VAR1 = {
'cc' => undef
};
CONTEXT: PL/Perl function "test3"
INFO: $VAR1 = '"a"=>"1", "b"=>"boo", "c"=>NULL';
CONTEXT: PL/Perl function "test3"
test3
-------
@ -161,7 +155,6 @@ INFO: $VAR1 = {
}
};
CONTEXT: PL/Perl function "test4"
SELECT * FROM test1;
a | b
---+---------------------------------

View File

@ -13,7 +13,6 @@ return len(val)
$$;
SELECT test1('aa=>bb, cc=>NULL'::hstore);
INFO: [('aa', 'bb'), ('cc', None)]
CONTEXT: PL/Python function "test1"
test1
-------
2
@ -32,7 +31,6 @@ return len(val)
$$;
SELECT test1n('aa=>bb, cc=>NULL'::hstore);
INFO: [('aa', 'bb'), ('cc', None)]
CONTEXT: PL/Python function "test1n"
test1n
--------
2

View File

@ -9,7 +9,6 @@ return len(val)
$$;
SELECT test1('aa.bb.cc'::ltree);
INFO: ['aa', 'bb', 'cc']
CONTEXT: PL/Python function "test1"
test1
-------
3
@ -24,7 +23,6 @@ return len(val)
$$;
SELECT test1n('aa.bb.cc'::ltree);
INFO: ['aa', 'bb', 'cc']
CONTEXT: PL/Python function "test1n"
test1n
--------
3

View File

@ -166,15 +166,10 @@ LINE 1: ..."regtest_schema"."regtest_table_3" pk ON ( pk."x" OPERATOR(p...
^
QUERY: SELECT fk."a" FROM ONLY "regtest_schema_2"."regtest_table" fk LEFT OUTER JOIN ONLY "regtest_schema"."regtest_table_3" pk ON ( pk."x" OPERATOR(pg_catalog.=) fk."a") WHERE pk."x" IS NULL AND (fk."a" IS NOT NULL)
LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog"
CONTEXT: SQL statement "SELECT fk."a" FROM ONLY "regtest_schema_2"."regtest_table" fk LEFT OUTER JOIN ONLY "regtest_schema"."regtest_table_3" pk ON ( pk."x" OPERATOR(pg_catalog.=) fk."a") WHERE pk."x" IS NULL AND (fk."a" IS NOT NULL)"
LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table"
CONTEXT: SQL statement "SELECT fk."a" FROM ONLY "regtest_schema_2"."regtest_table" fk LEFT OUTER JOIN ONLY "regtest_schema"."regtest_table_3" pk ON ( pk."x" OPERATOR(pg_catalog.=) fk."a") WHERE pk."x" IS NULL AND (fk."a" IS NOT NULL)"
LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table column a"
CONTEXT: SQL statement "SELECT fk."a" FROM ONLY "regtest_schema_2"."regtest_table" fk LEFT OUTER JOIN ONLY "regtest_schema"."regtest_table_3" pk ON ( pk."x" OPERATOR(pg_catalog.=) fk."a") WHERE pk."x" IS NULL AND (fk."a" IS NOT NULL)"
LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_3"
CONTEXT: SQL statement "SELECT fk."a" FROM ONLY "regtest_schema_2"."regtest_table" fk LEFT OUTER JOIN ONLY "regtest_schema"."regtest_table_3" pk ON ( pk."x" OPERATOR(pg_catalog.=) fk."a") WHERE pk."x" IS NULL AND (fk."a" IS NOT NULL)"
LOG: SELinux: allowed { select } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="table regtest_table_3 column x"
CONTEXT: SQL statement "SELECT fk."a" FROM ONLY "regtest_schema_2"."regtest_table" fk LEFT OUTER JOIN ONLY "regtest_schema"."regtest_table_3" pk ON ( pk."x" OPERATOR(pg_catalog.=) fk."a") WHERE pk."x" IS NULL AND (fk."a" IS NOT NULL)"
ALTER TABLE regtest_table ADD CONSTRAINT test_ck CHECK (b like '%abc%') NOT VALID; -- not supported
ALTER TABLE regtest_table VALIDATE CONSTRAINT test_ck; -- not supported
ALTER TABLE regtest_table DROP CONSTRAINT test_ck; -- not supported

View File

@ -136,7 +136,6 @@ SET client_min_messages = log;
SELECT f1(); -- normal procedure
LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_user_t:s0 tcontext=unconfined_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="public.f1()"
LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_user_t:s0 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.sepgsql_getcon()"
CONTEXT: SQL function "f1" statement 1
f1
-----------------------------------------------------
unconfined_u:unconfined_r:sepgsql_regtest_user_t:s0
@ -147,7 +146,6 @@ LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_re
LOG: SELinux: allowed { entrypoint } scontext=unconfined_u:unconfined_r:sepgsql_regtest_user_t:s0 tcontext=system_u:object_r:sepgsql_trusted_proc_exec_t:s0 tclass=db_procedure name="function f2()"
LOG: SELinux: allowed { transition } scontext=unconfined_u:unconfined_r:sepgsql_regtest_user_t:s0 tcontext=unconfined_u:unconfined_r:sepgsql_trusted_proc_t:s0 tclass=process
LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_trusted_proc_t:s0 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.sepgsql_getcon()"
CONTEXT: SQL function "f2" statement 1
f2
-----------------------------------------------------
unconfined_u:unconfined_r:sepgsql_trusted_proc_t:s0

View File

@ -5582,6 +5582,46 @@ PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity);
</listitem>
</varlistentry>
<varlistentry id="libpq-pqseterrorcontextvisibility">
<term>
<function>PQsetErrorContextVisibility</function>
<indexterm>
<primary>PQsetErrorContextVisibility</primary>
</indexterm>
</term>
<listitem>
<para>
Determines the handling of <literal>CONTEXT</> fields in messages
returned by <function>PQerrorMessage</>
and <function>PQresultErrorMessage</>.
<synopsis>
typedef enum
{
PQSHOW_CONTEXT_NEVER,
PQSHOW_CONTEXT_ERRORS,
PQSHOW_CONTEXT_ALWAYS
} PGContextVisibility;
PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, PGContextVisibility show_context);
</synopsis>
<function>PQsetErrorContextVisibility</> sets the context display mode,
returning the connection's previous setting. This mode controls
whether the <literal>CONTEXT</literal> field is included in messages
(unless the verbosity setting is <firstterm>TERSE</>, in which
case <literal>CONTEXT</> is never shown). The <firstterm>NEVER</> mode
never includes <literal>CONTEXT</>, while <firstterm>ALWAYS</> always
includes it if available. In <firstterm>ERRORS</> mode (the
default), <literal>CONTEXT</> fields are included only for error
messages, not for notices and warnings. Changing this mode does not
affect the messages available from
already-existing <structname>PGresult</> objects, only
subsequently-created ones.
</para>
</listitem>
</varlistentry>
<varlistentry id="libpq-pqtrace">
<term>
<function>PQtrace</function>

View File

@ -3190,6 +3190,21 @@ bar
</listitem>
</varlistentry>
<varlistentry>
<term><varname>SHOW_CONTEXT</varname></term>
<listitem>
<para>
This variable can be set to the
values <literal>never</>, <literal>errors</>, or <literal>always</>
to control whether <literal>CONTEXT</> fields are displayed in
messages from the server. The default is <literal>errors</> (meaning
that context will be shown in error messages, but not in notice or
warning messages). This setting has no effect
when <varname>VERBOSITY</> is set to <literal>terse</>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>SINGLELINE</varname></term>
<listitem>

View File

@ -2029,6 +2029,7 @@ SyncVariables(void)
/* send stuff to it, too */
PQsetErrorVerbosity(pset.db, pset.verbosity);
PQsetErrorContextVisibility(pset.db, pset.show_context);
}
/*

View File

@ -65,7 +65,11 @@ usage(unsigned short int pager)
}
}
output = PageOutput(59, pager ? &(pset.popt.topt) : NULL);
/*
* Keep this line count in sync with the number of lines printed below!
* Use "psql --help=options | wc" to count correctly.
*/
output = PageOutput(60, pager ? &(pset.popt.topt) : NULL);
fprintf(output, _("psql is the PostgreSQL interactive terminal.\n\n"));
fprintf(output, _("Usage:\n"));
@ -158,9 +162,12 @@ slashUsage(unsigned short int pager)
currdb = PQdb(pset.db);
output = PageOutput(103, pager ? &(pset.popt.topt) : NULL);
/* if you add/remove a line here, change the row count above */
/*
* Keep this line count in sync with the number of lines printed below!
* Use "psql --help=commands | wc" to count correctly. It's okay to count
* the USE_READLINE line even in builds without that.
*/
output = PageOutput(109, pager ? &(pset.popt.topt) : NULL);
fprintf(output, _("General\n"));
fprintf(output, _(" \\copyright show PostgreSQL usage and distribution terms\n"));
@ -307,7 +314,13 @@ helpVariables(unsigned short int pager)
{
FILE *output;
output = PageOutput(85, pager ? &(pset.popt.topt) : NULL);
/*
* Keep this line count in sync with the number of lines printed below!
* Use "psql --help=variables | wc" to count correctly; but notice that
* Windows builds currently print one more line than non-Windows builds.
* Using the larger number is fine.
*/
output = PageOutput(87, pager ? &(pset.popt.topt) : NULL);
fprintf(output, _("List of specially treated variables.\n"));
@ -339,6 +352,7 @@ helpVariables(unsigned short int pager)
fprintf(output, _(" PROMPT2 specify the prompt used when a statement continues from a previous line\n"));
fprintf(output, _(" PROMPT3 specify the prompt used during COPY ... FROM STDIN\n"));
fprintf(output, _(" QUIET run quietly (same as -q option)\n"));
fprintf(output, _(" SHOW_CONTEXT control display of message context fields [never, errors, always]\n"));
fprintf(output, _(" SINGLELINE end of line terminates SQL command mode (same as -S option)\n"));
fprintf(output, _(" SINGLESTEP single-step mode (same as -s option)\n"));
fprintf(output, _(" USER the currently connected database user\n"));

View File

@ -129,6 +129,7 @@ typedef struct _psqlSettings
const char *prompt2;
const char *prompt3;
PGVerbosity verbosity; /* current error verbosity level */
PGContextVisibility show_context; /* current context display level */
} PsqlSettings;
extern PsqlSettings pset;

View File

@ -154,6 +154,7 @@ main(int argc, char *argv[])
/* Default values for variables */
SetVariableBool(pset.vars, "AUTOCOMMIT");
SetVariable(pset.vars, "VERBOSITY", "default");
SetVariable(pset.vars, "SHOW_CONTEXT", "errors");
SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1);
SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2);
SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3);
@ -868,6 +869,28 @@ verbosity_hook(const char *newval)
PQsetErrorVerbosity(pset.db, pset.verbosity);
}
static void
show_context_hook(const char *newval)
{
if (newval == NULL)
pset.show_context = PQSHOW_CONTEXT_ERRORS;
else if (pg_strcasecmp(newval, "never") == 0)
pset.show_context = PQSHOW_CONTEXT_NEVER;
else if (pg_strcasecmp(newval, "errors") == 0)
pset.show_context = PQSHOW_CONTEXT_ERRORS;
else if (pg_strcasecmp(newval, "always") == 0)
pset.show_context = PQSHOW_CONTEXT_ALWAYS;
else
{
psql_error("unrecognized value \"%s\" for \"%s\"; assuming \"%s\"\n",
newval, "SHOW_CONTEXT", "errors");
pset.show_context = PQSHOW_CONTEXT_ERRORS;
}
if (pset.db)
PQsetErrorContextVisibility(pset.db, pset.show_context);
}
static void
EstablishVariableSpace(void)
@ -889,4 +912,5 @@ EstablishVariableSpace(void)
SetVariableAssignHook(pset.vars, "PROMPT2", prompt2_hook);
SetVariableAssignHook(pset.vars, "PROMPT3", prompt3_hook);
SetVariableAssignHook(pset.vars, "VERBOSITY", verbosity_hook);
SetVariableAssignHook(pset.vars, "SHOW_CONTEXT", show_context_hook);
}

View File

@ -3962,6 +3962,13 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST_CS(boolean_value_list);
else if (strcmp(prev_wd, "QUIET") == 0)
COMPLETE_WITH_LIST_CS(boolean_value_list);
else if (strcmp(prev_wd, "SHOW_CONTEXT") == 0)
{
static const char *const my_list[] =
{"never", "errors", "always", NULL};
COMPLETE_WITH_LIST_CS(my_list);
}
else if (strcmp(prev_wd, "SINGLELINE") == 0)
COMPLETE_WITH_LIST_CS(boolean_value_list);
else if (strcmp(prev_wd, "SINGLESTEP") == 0)
@ -4461,8 +4468,9 @@ complete_from_variables(const char *text, const char *prefix, const char *suffix
"AUTOCOMMIT", "COMP_KEYWORD_CASE", "DBNAME", "ECHO", "ECHO_HIDDEN",
"ENCODING", "FETCH_COUNT", "HISTCONTROL", "HISTFILE", "HISTSIZE",
"HOST", "IGNOREEOF", "LASTOID", "ON_ERROR_ROLLBACK", "ON_ERROR_STOP",
"PORT", "PROMPT1", "PROMPT2", "PROMPT3", "QUIET", "SINGLELINE",
"SINGLESTEP", "USER", "VERBOSITY", NULL
"PORT", "PROMPT1", "PROMPT2", "PROMPT3", "QUIET",
"SHOW_CONTEXT", "SINGLELINE", "SINGLESTEP",
"USER", "VERBOSITY", NULL
};
varnames = (char **) pg_malloc((maxvars + 1) * sizeof(char *));

View File

@ -169,3 +169,4 @@ PQsslInUse 166
PQsslStruct 167
PQsslAttributes 168
PQsslAttribute 169
PQsetErrorContextVisibility 170

View File

@ -2782,6 +2782,7 @@ makeEmptyPGconn(void)
conn->client_encoding = PG_SQL_ASCII;
conn->std_strings = false; /* unless server says differently */
conn->verbosity = PQERRORS_DEFAULT;
conn->show_context = PQSHOW_CONTEXT_ERRORS;
conn->sock = PGINVALID_SOCKET;
conn->auth_req_received = false;
conn->password_needed = false;
@ -5553,6 +5554,18 @@ PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity)
return old;
}
PGContextVisibility
PQsetErrorContextVisibility(PGconn *conn, PGContextVisibility show_context)
{
PGContextVisibility old;
if (!conn)
return PQSHOW_CONTEXT_ERRORS;
old = conn->show_context;
conn->show_context = show_context;
return old;
}
void
PQtrace(PGconn *conn, FILE *debug_port)
{

View File

@ -250,7 +250,7 @@ pqParseInput3(PGconn *conn)
if (!conn->result)
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("out of memory"));
libpq_gettext("out of memory"));
pqSaveErrorResult(conn);
}
}
@ -321,7 +321,7 @@ pqParseInput3(PGconn *conn)
if (!conn->result)
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("out of memory"));
libpq_gettext("out of memory"));
pqSaveErrorResult(conn);
}
}
@ -934,9 +934,14 @@ pqGetErrorNotice3(PGconn *conn, bool isError)
val = PQresultErrorField(res, PG_DIAG_INTERNAL_QUERY);
if (val)
appendPQExpBuffer(&workBuf, libpq_gettext("QUERY: %s\n"), val);
val = PQresultErrorField(res, PG_DIAG_CONTEXT);
if (val)
appendPQExpBuffer(&workBuf, libpq_gettext("CONTEXT: %s\n"), val);
if (conn->show_context == PQSHOW_CONTEXT_ALWAYS ||
(conn->show_context == PQSHOW_CONTEXT_ERRORS && isError))
{
val = PQresultErrorField(res, PG_DIAG_CONTEXT);
if (val)
appendPQExpBuffer(&workBuf, libpq_gettext("CONTEXT: %s\n"),
val);
}
}
if (conn->verbosity == PQERRORS_VERBOSE)
{

View File

@ -110,6 +110,13 @@ typedef enum
PQERRORS_VERBOSE /* all the facts, ma'am */
} PGVerbosity;
typedef enum
{
PQSHOW_CONTEXT_NEVER, /* never show CONTEXT field */
PQSHOW_CONTEXT_ERRORS, /* show CONTEXT for errors only (default) */
PQSHOW_CONTEXT_ALWAYS /* always show CONTEXT field */
} PGContextVisibility;
/*
* PGPing - The ordering of this enum should not be altered because the
* values are exposed externally via pg_isready.
@ -337,6 +344,10 @@ extern void PQinitOpenSSL(int do_ssl, int do_crypto);
/* Set verbosity for PQerrorMessage and PQresultErrorMessage */
extern PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity);
/* Set CONTEXT visibility for PQerrorMessage and PQresultErrorMessage */
extern PGContextVisibility PQsetErrorContextVisibility(PGconn *conn,
PGContextVisibility show_context);
/* Enable/disable tracing */
extern void PQtrace(PGconn *conn, FILE *debug_port);
extern void PQuntrace(PGconn *conn);

View File

@ -394,6 +394,7 @@ struct pg_conn
int client_encoding; /* encoding id */
bool std_strings; /* standard_conforming_strings */
PGVerbosity verbosity; /* error/notice message verbosity */
PGContextVisibility show_context; /* whether to show CONTEXT field */
PGlobjfuncs *lobjfuncs; /* private state for large-object access fns */
/* Buffer for data received from backend and not yet processed */

View File

@ -614,7 +614,6 @@ DO $$
elog(NOTICE, $a);
$$ LANGUAGE plperl;
NOTICE: This is a test
CONTEXT: PL/Perl anonymous code block
-- check that restricted operations are rejected in a plperl DO block
DO $$ system("/nonesuch"); $$ LANGUAGE plperl;
ERROR: 'system' trapped by operation mask at line 1.
@ -628,7 +627,6 @@ CONTEXT: PL/Perl anonymous code block
-- check that eval is allowed and eval'd restricted ops are caught
DO $$ eval q{chdir '.';}; warn "Caught: $@"; $$ LANGUAGE plperl;
WARNING: Caught: 'chdir' trapped by operation mask at line 1.
CONTEXT: PL/Perl anonymous code block
-- check that compiling do (dofile opcode) is allowed
-- but that executing it for a file not already loaded (via require) dies
DO $$ warn do "/dev/null"; $$ LANGUAGE plperl;

View File

@ -7,7 +7,6 @@ create or replace function perl_elog(text) returns void language plperl as $$
$$;
select perl_elog('explicit elog');
NOTICE: explicit elog
CONTEXT: PL/Perl function "perl_elog"
perl_elog
-----------
@ -21,7 +20,6 @@ create or replace function perl_warn(text) returns void language plperl as $$
$$;
select perl_warn('implicit elog via warn');
WARNING: implicit elog via warn at line 4.
CONTEXT: PL/Perl function "perl_warn"
perl_warn
-----------
@ -61,7 +59,6 @@ select uses_global();
-- make sure we don't choke on readonly values
do language plperl $$ elog(NOTICE, ${^TAINT}); $$;
NOTICE: 0
CONTEXT: PL/Perl anonymous code block
-- test recovery after "die"
create or replace function just_die() returns void language plperl AS $$
die "just die";
@ -94,11 +91,7 @@ return $a + $b;
$$;
select indirect_die_caller();
NOTICE: caught die
CONTEXT: SQL statement "SELECT die_caller() AS fx"
PL/Perl function "indirect_die_caller"
NOTICE: caught die
CONTEXT: SQL statement "SELECT die_caller() AS fx"
PL/Perl function "indirect_die_caller"
indirect_die_caller
---------------------
2

View File

@ -7,7 +7,6 @@ create or replace function perl_elog(text) returns void language plperl as $$
$$;
select perl_elog('explicit elog');
NOTICE: explicit elog
CONTEXT: PL/Perl function "perl_elog"
perl_elog
-----------
@ -21,7 +20,6 @@ create or replace function perl_warn(text) returns void language plperl as $$
$$;
select perl_warn('implicit elog via warn');
WARNING: implicit elog via warn at line 4.
CONTEXT: PL/Perl function "perl_warn"
perl_warn
-----------
@ -61,7 +59,6 @@ select uses_global();
-- make sure we don't choke on readonly values
do language plperl $$ elog(NOTICE, ${^TAINT}); $$;
NOTICE: 0
CONTEXT: PL/Perl anonymous code block
-- test recovery after "die"
create or replace function just_die() returns void language plperl AS $$
die "just die";
@ -94,11 +91,7 @@ return $a + $b;
$$;
select indirect_die_caller();
NOTICE: caught die
CONTEXT: SQL statement "SELECT die_caller() AS fx"
PL/Perl function "indirect_die_caller"
NOTICE: caught die
CONTEXT: SQL statement "SELECT die_caller() AS fx"
PL/Perl function "indirect_die_caller"
indirect_die_caller
---------------------
2

View File

@ -62,75 +62,41 @@ BEFORE INSERT OR UPDATE OR DELETE ON trigger_test
FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo');
insert into trigger_test values(1,'insert', '("(1)")');
NOTICE: $_TD->{argc} = '2'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{args} = ['23', 'skidoo']
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{event} = 'INSERT'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{level} = 'ROW'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{name} = 'show_trigger_data_trig'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{new} = {'foo' => {'rfoo' => {'i' => '1'}}, 'i' => '1', 'v' => 'insert'}
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relid} = 'bogus:12345'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relname} = 'trigger_test'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_name} = 'trigger_test'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_schema} = 'public'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{when} = 'BEFORE'
CONTEXT: PL/Perl function "trigger_data"
update trigger_test set v = 'update' where i = 1;
NOTICE: $_TD->{argc} = '2'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{args} = ['23', 'skidoo']
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{event} = 'UPDATE'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{level} = 'ROW'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{name} = 'show_trigger_data_trig'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{new} = {'foo' => {'rfoo' => {'i' => '1'}}, 'i' => '1', 'v' => 'update'}
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{old} = {'foo' => {'rfoo' => {'i' => '1'}}, 'i' => '1', 'v' => 'insert'}
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relid} = 'bogus:12345'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relname} = 'trigger_test'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_name} = 'trigger_test'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_schema} = 'public'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{when} = 'BEFORE'
CONTEXT: PL/Perl function "trigger_data"
delete from trigger_test;
NOTICE: $_TD->{argc} = '2'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{args} = ['23', 'skidoo']
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{event} = 'DELETE'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{level} = 'ROW'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{name} = 'show_trigger_data_trig'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{old} = {'foo' => {'rfoo' => {'i' => '1'}}, 'i' => '1', 'v' => 'update'}
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relid} = 'bogus:12345'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relname} = 'trigger_test'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_name} = 'trigger_test'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_schema} = 'public'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{when} = 'BEFORE'
CONTEXT: PL/Perl function "trigger_data"
DROP TRIGGER show_trigger_data_trig on trigger_test;
insert into trigger_test values(1,'insert', '("(1)")');
CREATE VIEW trigger_test_view AS SELECT * FROM trigger_test;
@ -139,75 +105,41 @@ INSTEAD OF INSERT OR UPDATE OR DELETE ON trigger_test_view
FOR EACH ROW EXECUTE PROCEDURE trigger_data(24,'skidoo view');
insert into trigger_test_view values(2,'insert', '("(2)")');
NOTICE: $_TD->{argc} = '2'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{args} = ['24', 'skidoo view']
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{event} = 'INSERT'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{level} = 'ROW'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{name} = 'show_trigger_data_trig'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{new} = {'foo' => {'rfoo' => {'i' => '2'}}, 'i' => '2', 'v' => 'insert'}
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relid} = 'bogus:12345'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relname} = 'trigger_test_view'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_name} = 'trigger_test_view'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_schema} = 'public'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{when} = 'INSTEAD OF'
CONTEXT: PL/Perl function "trigger_data"
update trigger_test_view set v = 'update', foo = '("(3)")' where i = 1;
NOTICE: $_TD->{argc} = '2'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{args} = ['24', 'skidoo view']
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{event} = 'UPDATE'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{level} = 'ROW'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{name} = 'show_trigger_data_trig'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{new} = {'foo' => {'rfoo' => {'i' => '3'}}, 'i' => '1', 'v' => 'update'}
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{old} = {'foo' => {'rfoo' => {'i' => '1'}}, 'i' => '1', 'v' => 'insert'}
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relid} = 'bogus:12345'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relname} = 'trigger_test_view'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_name} = 'trigger_test_view'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_schema} = 'public'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{when} = 'INSTEAD OF'
CONTEXT: PL/Perl function "trigger_data"
delete from trigger_test_view;
NOTICE: $_TD->{argc} = '2'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{args} = ['24', 'skidoo view']
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{event} = 'DELETE'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{level} = 'ROW'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{name} = 'show_trigger_data_trig'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{old} = {'foo' => {'rfoo' => {'i' => '1'}}, 'i' => '1', 'v' => 'insert'}
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relid} = 'bogus:12345'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{relname} = 'trigger_test_view'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_name} = 'trigger_test_view'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{table_schema} = 'public'
CONTEXT: PL/Perl function "trigger_data"
NOTICE: $_TD->{when} = 'INSTEAD OF'
CONTEXT: PL/Perl function "trigger_data"
DROP VIEW trigger_test_view;
delete from trigger_test;
DROP FUNCTION trigger_data();
@ -319,28 +251,18 @@ create event trigger perl_b_snitch on ddl_command_end
execute procedure perlsnitch();
create or replace function foobar() returns int language sql as $$select 1;$$;
NOTICE: perlsnitch: ddl_command_start CREATE FUNCTION
CONTEXT: PL/Perl function "perlsnitch"
NOTICE: perlsnitch: ddl_command_end CREATE FUNCTION
CONTEXT: PL/Perl function "perlsnitch"
alter function foobar() cost 77;
NOTICE: perlsnitch: ddl_command_start ALTER FUNCTION
CONTEXT: PL/Perl function "perlsnitch"
NOTICE: perlsnitch: ddl_command_end ALTER FUNCTION
CONTEXT: PL/Perl function "perlsnitch"
drop function foobar();
NOTICE: perlsnitch: ddl_command_start DROP FUNCTION
CONTEXT: PL/Perl function "perlsnitch"
NOTICE: perlsnitch: ddl_command_end DROP FUNCTION
CONTEXT: PL/Perl function "perlsnitch"
create table foo();
NOTICE: perlsnitch: ddl_command_start CREATE TABLE
CONTEXT: PL/Perl function "perlsnitch"
NOTICE: perlsnitch: ddl_command_end CREATE TABLE
CONTEXT: PL/Perl function "perlsnitch"
drop table foo;
NOTICE: perlsnitch: ddl_command_start DROP TABLE
CONTEXT: PL/Perl function "perlsnitch"
NOTICE: perlsnitch: ddl_command_end DROP TABLE
CONTEXT: PL/Perl function "perlsnitch"
drop event trigger perl_a_snitch;
drop event trigger perl_b_snitch;

View File

@ -6,7 +6,6 @@ LOAD 'plperl';
SET plperl.on_plperlu_init = '$_SHARED{init} = 42';
DO $$ warn $_SHARED{init} $$ language plperlu;
WARNING: 42 at line 1.
CONTEXT: PL/Perl anonymous code block
--
-- Test compilation of unicode regex - regardless of locale.
-- This code fails in plain plperl in a non-UTF8 database.

View File

@ -42,8 +42,6 @@
#include "utils/typcache.h"
static const char *const raise_skip_msg = "RAISE";
typedef struct
{
int nargs; /* number of arguments */
@ -933,10 +931,6 @@ plpgsql_exec_error_callback(void *arg)
{
PLpgSQL_execstate *estate = (PLpgSQL_execstate *) arg;
/* if we are doing RAISE, don't report its location */
if (estate->err_text == raise_skip_msg)
return;
if (estate->err_text != NULL)
{
/*
@ -3152,8 +3146,6 @@ exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt)
/*
* Throw the error (may or may not come back)
*/
estate->err_text = raise_skip_msg; /* suppress traceback of raise */
ereport(stmt->elog_level,
(err_code ? errcode(err_code) : 0,
errmsg_internal("%s", err_message),
@ -3170,8 +3162,6 @@ exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt)
(err_schema != NULL) ?
err_generic_string(PG_DIAG_SCHEMA_NAME, err_schema) : 0));
estate->err_text = NULL; /* un-suppress... */
if (condname != NULL)
pfree(condname);
if (err_message != NULL)

View File

@ -1,9 +1,7 @@
DO $$ plpy.notice("This is plpythonu.") $$ LANGUAGE plpythonu;
NOTICE: This is plpythonu.
CONTEXT: PL/Python anonymous code block
DO $$ plpy.notice("This is plpython2u.") $$ LANGUAGE plpython2u;
NOTICE: This is plpython2u.
CONTEXT: PL/Python anonymous code block
DO $$ raise Exception("error test") $$ LANGUAGE plpythonu;
ERROR: Exception: error test
CONTEXT: Traceback (most recent call last):

View File

@ -108,7 +108,6 @@ return None
LANGUAGE plpythonu;
SELECT invalid_type_caught('rick');
NOTICE: type "test" does not exist
CONTEXT: PL/Python function "invalid_type_caught"
invalid_type_caught
---------------------
@ -232,7 +231,6 @@ return "you''ve been warned"
LANGUAGE plpythonu;
SELECT nested_warning();
WARNING: boom
CONTEXT: PL/Python function "nested_warning"
nested_warning
--------------------
you've been warned
@ -336,7 +334,6 @@ SELECT specific_exception(2);
SELECT specific_exception(NULL);
NOTICE: Violated the NOT NULL constraint, sqlstate 23502
CONTEXT: PL/Python function "specific_exception"
specific_exception
--------------------
@ -344,7 +341,6 @@ CONTEXT: PL/Python function "specific_exception"
SELECT specific_exception(2);
NOTICE: Violated the UNIQUE constraint, sqlstate 23505
CONTEXT: PL/Python function "specific_exception"
specific_exception
--------------------

View File

@ -108,7 +108,6 @@ return None
LANGUAGE plpythonu;
SELECT invalid_type_caught('rick');
NOTICE: type "test" does not exist
CONTEXT: PL/Python function "invalid_type_caught"
invalid_type_caught
---------------------
@ -232,7 +231,6 @@ return "you''ve been warned"
LANGUAGE plpythonu;
SELECT nested_warning();
WARNING: boom
CONTEXT: PL/Python function "nested_warning"
nested_warning
--------------------
you've been warned
@ -336,7 +334,6 @@ SELECT specific_exception(2);
SELECT specific_exception(NULL);
NOTICE: Violated the NOT NULL constraint, sqlstate 23502
CONTEXT: PL/Python function "specific_exception"
specific_exception
--------------------
@ -344,7 +341,6 @@ CONTEXT: PL/Python function "specific_exception"
SELECT specific_exception(2);
NOTICE: Violated the UNIQUE constraint, sqlstate 23505
CONTEXT: PL/Python function "specific_exception"
specific_exception
--------------------

View File

@ -108,7 +108,6 @@ return None
LANGUAGE plpython3u;
SELECT invalid_type_caught('rick');
NOTICE: type "test" does not exist
CONTEXT: PL/Python function "invalid_type_caught"
invalid_type_caught
---------------------
@ -232,7 +231,6 @@ return "you''ve been warned"
LANGUAGE plpython3u;
SELECT nested_warning();
WARNING: boom
CONTEXT: PL/Python function "nested_warning"
nested_warning
--------------------
you've been warned
@ -336,7 +334,6 @@ SELECT specific_exception(2);
SELECT specific_exception(NULL);
NOTICE: Violated the NOT NULL constraint, sqlstate 23502
CONTEXT: PL/Python function "specific_exception"
specific_exception
--------------------
@ -344,7 +341,6 @@ CONTEXT: PL/Python function "specific_exception"
SELECT specific_exception(2);
NOTICE: Violated the UNIQUE constraint, sqlstate 23505
CONTEXT: PL/Python function "specific_exception"
specific_exception
--------------------

View File

@ -130,13 +130,9 @@ else:
$$ LANGUAGE plpythonu;
SELECT result_metadata_test($$SELECT 1 AS foo, '11'::text AS bar UNION SELECT 2, '22'$$);
INFO: True
CONTEXT: PL/Python function "result_metadata_test"
INFO: ['foo', 'bar']
CONTEXT: PL/Python function "result_metadata_test"
INFO: [23, 25]
CONTEXT: PL/Python function "result_metadata_test"
INFO: [-1, -1]
CONTEXT: PL/Python function "result_metadata_test"
result_metadata_test
----------------------
2
@ -144,7 +140,6 @@ CONTEXT: PL/Python function "result_metadata_test"
SELECT result_metadata_test($$CREATE TEMPORARY TABLE foo1 (a int, b text)$$);
INFO: True
CONTEXT: PL/Python function "result_metadata_test"
ERROR: plpy.Error: command did not produce a result set
CONTEXT: Traceback (most recent call last):
PL/Python function "result_metadata_test", line 6, in <module>
@ -234,15 +229,10 @@ else:
$$ LANGUAGE plpythonu;
SELECT result_subscript_test();
INFO: 2
CONTEXT: PL/Python function "result_subscript_test"
INFO: 4
CONTEXT: PL/Python function "result_subscript_test"
INFO: [2, 3]
CONTEXT: PL/Python function "result_subscript_test"
INFO: [1, 3]
CONTEXT: PL/Python function "result_subscript_test"
INFO: [10, 100, 3, 1000]
CONTEXT: PL/Python function "result_subscript_test"
result_subscript_test
-----------------------
@ -257,7 +247,6 @@ plpy.info(result[:])
$$ LANGUAGE plpythonu;
SELECT result_empty_test();
INFO: []
CONTEXT: PL/Python function "result_empty_test"
result_empty_test
-------------------

View File

@ -154,7 +154,6 @@ SELECT * FROM subtransaction_tbl;
TRUNCATE subtransaction_tbl;
SELECT subtransaction_nested_test('t');
NOTICE: Swallowed SyntaxError('syntax error at or near "error"',)
CONTEXT: PL/Python function "subtransaction_nested_test"
subtransaction_nested_test
----------------------------
ok
@ -180,9 +179,6 @@ return "ok"
$$ LANGUAGE plpythonu;
SELECT subtransaction_deeply_nested_test();
NOTICE: Swallowed SyntaxError('syntax error at or near "error"',)
CONTEXT: PL/Python function "subtransaction_nested_test"
SQL statement "SELECT subtransaction_nested_test('t')"
PL/Python function "subtransaction_nested_test"
subtransaction_deeply_nested_test
-----------------------------------
ok
@ -251,7 +247,6 @@ CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_without_enter"
SELECT subtransaction_enter_without_exit();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_without_exit"
subtransaction_enter_without_exit
-----------------------------------
@ -259,7 +254,6 @@ CONTEXT: PL/Python function "subtransaction_enter_without_exit"
SELECT subtransaction_exit_twice();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_exit_twice"
ERROR: ValueError: this subtransaction has not been entered
CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_twice", line 3, in <module>
@ -267,9 +261,7 @@ CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_twice"
SELECT subtransaction_enter_twice();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_twice"
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_twice"
subtransaction_enter_twice
----------------------------
@ -283,7 +275,6 @@ CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_same_subtransaction_twice"
SELECT subtransaction_enter_same_subtransaction_twice();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_same_subtransaction_twice"
ERROR: ValueError: this subtransaction has already been entered
CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_enter_same_subtransaction_twice", line 4, in <module>
@ -329,9 +320,7 @@ except plpy.SPIError:
$$ LANGUAGE plpythonu;
SELECT subtransaction_mix_explicit_and_implicit();
WARNING: Caught a SPI error from an explicit subtransaction
CONTEXT: PL/Python function "subtransaction_mix_explicit_and_implicit"
WARNING: Caught a SPI error
CONTEXT: PL/Python function "subtransaction_mix_explicit_and_implicit"
subtransaction_mix_explicit_and_implicit
------------------------------------------
@ -370,7 +359,6 @@ with plpy.subtransaction():
$$ LANGUAGE plpythonu;
SELECT try_catch_inside_subtransaction();
NOTICE: caught
CONTEXT: PL/Python function "try_catch_inside_subtransaction"
try_catch_inside_subtransaction
---------------------------------
@ -395,7 +383,6 @@ with plpy.subtransaction():
$$ LANGUAGE plpythonu;
SELECT pk_violation_inside_subtransaction();
NOTICE: caught
CONTEXT: PL/Python function "pk_violation_inside_subtransaction"
pk_violation_inside_subtransaction
------------------------------------

View File

@ -235,7 +235,6 @@ CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_without_enter"
SELECT subtransaction_enter_without_exit();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_without_exit"
subtransaction_enter_without_exit
-----------------------------------
@ -243,7 +242,6 @@ CONTEXT: PL/Python function "subtransaction_enter_without_exit"
SELECT subtransaction_exit_twice();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_exit_twice"
ERROR: ValueError: this subtransaction has not been entered
CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_twice", line 3, in <module>
@ -251,9 +249,7 @@ CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_twice"
SELECT subtransaction_enter_twice();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_twice"
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_twice"
subtransaction_enter_twice
----------------------------
@ -267,7 +263,6 @@ CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_same_subtransaction_twice"
SELECT subtransaction_enter_same_subtransaction_twice();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_same_subtransaction_twice"
ERROR: ValueError: this subtransaction has already been entered
CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_enter_same_subtransaction_twice", line 4, in <module>

View File

@ -235,7 +235,6 @@ CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_without_enter"
SELECT subtransaction_enter_without_exit();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_without_exit"
subtransaction_enter_without_exit
-----------------------------------
@ -243,7 +242,6 @@ CONTEXT: PL/Python function "subtransaction_enter_without_exit"
SELECT subtransaction_exit_twice();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_exit_twice"
ERROR: ValueError: this subtransaction has not been entered
CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_twice", line 3, in <module>
@ -251,9 +249,7 @@ CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_twice"
SELECT subtransaction_enter_twice();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_twice"
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_twice"
subtransaction_enter_twice
----------------------------
@ -267,7 +263,6 @@ CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_exit_same_subtransaction_twice"
SELECT subtransaction_enter_same_subtransaction_twice();
WARNING: forcibly aborting a subtransaction that has not been exited
CONTEXT: PL/Python function "subtransaction_enter_same_subtransaction_twice"
ERROR: ValueError: this subtransaction has already been entered
CONTEXT: Traceback (most recent call last):
PL/Python function "subtransaction_enter_same_subtransaction_twice", line 4, in <module>

View File

@ -62,17 +62,11 @@ plpy.error('error')
$$ LANGUAGE plpythonu;
SELECT elog_test();
INFO: info
CONTEXT: PL/Python function "elog_test"
INFO: 37
CONTEXT: PL/Python function "elog_test"
INFO: ()
CONTEXT: PL/Python function "elog_test"
INFO: ('info', 37, [1, 2, 3])
CONTEXT: PL/Python function "elog_test"
NOTICE: notice
CONTEXT: PL/Python function "elog_test"
WARNING: warning
CONTEXT: PL/Python function "elog_test"
ERROR: plpy.Error: error
CONTEXT: Traceback (most recent call last):
PL/Python function "elog_test", line 10, in <module>

View File

@ -98,208 +98,108 @@ BEFORE INSERT OR UPDATE OR DELETE OR TRUNCATE ON trigger_test
FOR EACH STATEMENT EXECUTE PROCEDURE trigger_data(23,'skidoo');
insert into trigger_test values(1,'insert');
NOTICE: TD[args] => ['23', 'skidoo']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => INSERT
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => STATEMENT
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig_stmt
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => BEFORE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[args] => ['23', 'skidoo']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => INSERT
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => ROW
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig_before
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => {'i': 1, 'v': 'insert'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => BEFORE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[args] => ['23', 'skidoo']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => INSERT
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => ROW
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig_after
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => {'i': 1, 'v': 'insert'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => AFTER
CONTEXT: PL/Python function "trigger_data"
update trigger_test set v = 'update' where i = 1;
NOTICE: TD[args] => ['23', 'skidoo']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => UPDATE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => STATEMENT
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig_stmt
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => BEFORE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[args] => ['23', 'skidoo']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => UPDATE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => ROW
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig_before
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => {'i': 1, 'v': 'update'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => {'i': 1, 'v': 'insert'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => BEFORE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[args] => ['23', 'skidoo']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => UPDATE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => ROW
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig_after
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => {'i': 1, 'v': 'update'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => {'i': 1, 'v': 'insert'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => AFTER
CONTEXT: PL/Python function "trigger_data"
delete from trigger_test;
NOTICE: TD[args] => ['23', 'skidoo']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => DELETE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => STATEMENT
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig_stmt
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => BEFORE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[args] => ['23', 'skidoo']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => DELETE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => ROW
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig_before
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => {'i': 1, 'v': 'update'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => BEFORE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[args] => ['23', 'skidoo']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => DELETE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => ROW
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig_after
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => {'i': 1, 'v': 'update'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => AFTER
CONTEXT: PL/Python function "trigger_data"
truncate table trigger_test;
NOTICE: TD[args] => ['23', 'skidoo']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => TRUNCATE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => STATEMENT
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig_stmt
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => BEFORE
CONTEXT: PL/Python function "trigger_data"
DROP TRIGGER show_trigger_data_trig_stmt on trigger_test;
DROP TRIGGER show_trigger_data_trig_before on trigger_test;
DROP TRIGGER show_trigger_data_trig_after on trigger_test;
@ -310,67 +210,37 @@ INSTEAD OF INSERT OR UPDATE OR DELETE ON trigger_test_view
FOR EACH ROW EXECUTE PROCEDURE trigger_data(24,'skidoo view');
insert into trigger_test_view values(2,'insert');
NOTICE: TD[args] => ['24', 'skidoo view']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => INSERT
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => ROW
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => {'i': 2, 'v': 'insert'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test_view
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => INSTEAD OF
CONTEXT: PL/Python function "trigger_data"
update trigger_test_view set v = 'update' where i = 1;
NOTICE: TD[args] => ['24', 'skidoo view']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => UPDATE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => ROW
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => {'i': 1, 'v': 'update'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => {'i': 1, 'v': 'insert'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test_view
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => INSTEAD OF
CONTEXT: PL/Python function "trigger_data"
delete from trigger_test_view;
NOTICE: TD[args] => ['24', 'skidoo view']
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[event] => DELETE
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[level] => ROW
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[name] => show_trigger_data_trig
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[new] => None
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[old] => {'i': 1, 'v': 'insert'}
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[relid] => bogus:12345
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_name] => trigger_test_view
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[table_schema] => public
CONTEXT: PL/Python function "trigger_data"
NOTICE: TD[when] => INSTEAD OF
CONTEXT: PL/Python function "trigger_data"
DROP FUNCTION trigger_data() CASCADE;
NOTICE: drop cascades to trigger show_trigger_data_trig on view trigger_test_view
DROP VIEW trigger_test_view;
@ -402,7 +272,6 @@ BEFORE DELETE ON trigger_test
FOR EACH ROW EXECUTE PROCEDURE stupid2();
DELETE FROM trigger_test WHERE i = 0;
WARNING: PL/Python trigger function returned "MODIFY" in a DELETE trigger -- ignored
CONTEXT: PL/Python function "stupid2"
DROP TRIGGER stupid_trigger2 ON trigger_test;
INSERT INTO trigger_test VALUES (0, 'zero');
-- returning unrecognized string from trigger function

View File

@ -10,7 +10,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_bool(true);
INFO: (True, <type 'bool'>)
CONTEXT: PL/Python function "test_type_conversion_bool"
test_type_conversion_bool
---------------------------
t
@ -18,7 +17,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool"
SELECT * FROM test_type_conversion_bool(false);
INFO: (False, <type 'bool'>)
CONTEXT: PL/Python function "test_type_conversion_bool"
test_type_conversion_bool
---------------------------
f
@ -26,7 +24,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool"
SELECT * FROM test_type_conversion_bool(null);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_bool"
test_type_conversion_bool
---------------------------
@ -54,7 +51,6 @@ return ret
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_bool_other(0);
INFO: (0, False)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
f
@ -62,7 +58,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool_other"
SELECT * FROM test_type_conversion_bool_other(1);
INFO: (5, True)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
t
@ -70,7 +65,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool_other"
SELECT * FROM test_type_conversion_bool_other(2);
INFO: ('', False)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
f
@ -78,7 +72,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool_other"
SELECT * FROM test_type_conversion_bool_other(3);
INFO: ('fa', True)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
t
@ -86,7 +79,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool_other"
SELECT * FROM test_type_conversion_bool_other(4);
INFO: ([], False)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
f
@ -94,7 +86,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool_other"
SELECT * FROM test_type_conversion_bool_other(5);
INFO: ([0], True)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
t
@ -106,7 +97,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_char('a');
INFO: ('a', <type 'str'>)
CONTEXT: PL/Python function "test_type_conversion_char"
test_type_conversion_char
---------------------------
a
@ -114,7 +104,6 @@ CONTEXT: PL/Python function "test_type_conversion_char"
SELECT * FROM test_type_conversion_char(null);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_char"
test_type_conversion_char
---------------------------
@ -126,7 +115,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_int2(100::int2);
INFO: (100, <type 'int'>)
CONTEXT: PL/Python function "test_type_conversion_int2"
test_type_conversion_int2
---------------------------
100
@ -134,7 +122,6 @@ CONTEXT: PL/Python function "test_type_conversion_int2"
SELECT * FROM test_type_conversion_int2(-100::int2);
INFO: (-100, <type 'int'>)
CONTEXT: PL/Python function "test_type_conversion_int2"
test_type_conversion_int2
---------------------------
-100
@ -142,7 +129,6 @@ CONTEXT: PL/Python function "test_type_conversion_int2"
SELECT * FROM test_type_conversion_int2(null);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_int2"
test_type_conversion_int2
---------------------------
@ -154,7 +140,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_int4(100);
INFO: (100, <type 'int'>)
CONTEXT: PL/Python function "test_type_conversion_int4"
test_type_conversion_int4
---------------------------
100
@ -162,7 +147,6 @@ CONTEXT: PL/Python function "test_type_conversion_int4"
SELECT * FROM test_type_conversion_int4(-100);
INFO: (-100, <type 'int'>)
CONTEXT: PL/Python function "test_type_conversion_int4"
test_type_conversion_int4
---------------------------
-100
@ -170,7 +154,6 @@ CONTEXT: PL/Python function "test_type_conversion_int4"
SELECT * FROM test_type_conversion_int4(null);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_int4"
test_type_conversion_int4
---------------------------
@ -182,7 +165,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_int8(100);
INFO: (100L, <type 'long'>)
CONTEXT: PL/Python function "test_type_conversion_int8"
test_type_conversion_int8
---------------------------
100
@ -190,7 +172,6 @@ CONTEXT: PL/Python function "test_type_conversion_int8"
SELECT * FROM test_type_conversion_int8(-100);
INFO: (-100L, <type 'long'>)
CONTEXT: PL/Python function "test_type_conversion_int8"
test_type_conversion_int8
---------------------------
-100
@ -198,7 +179,6 @@ CONTEXT: PL/Python function "test_type_conversion_int8"
SELECT * FROM test_type_conversion_int8(5000000000);
INFO: (5000000000L, <type 'long'>)
CONTEXT: PL/Python function "test_type_conversion_int8"
test_type_conversion_int8
---------------------------
5000000000
@ -206,7 +186,6 @@ CONTEXT: PL/Python function "test_type_conversion_int8"
SELECT * FROM test_type_conversion_int8(null);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_int8"
test_type_conversion_int8
---------------------------
@ -220,7 +199,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_numeric(100);
INFO: ('100', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
100
@ -228,7 +206,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(-100);
INFO: ('-100', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
-100
@ -236,7 +213,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(100.0);
INFO: ('100.0', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
100.0
@ -244,7 +220,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(100.00);
INFO: ('100.00', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
100.00
@ -252,7 +227,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(5000000000.5);
INFO: ('5000000000.5', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
5000000000.5
@ -260,7 +234,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(1234567890.0987654321);
INFO: ('1234567890.0987654321', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
1234567890.0987654321
@ -268,7 +241,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(-1234567890.0987654321);
INFO: ('-1234567890.0987654321', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
-1234567890.0987654321
@ -276,7 +248,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(null);
INFO: ('None', 'NoneType')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
@ -288,7 +259,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_float4(100);
INFO: (100.0, <type 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float4"
test_type_conversion_float4
-----------------------------
100
@ -296,7 +266,6 @@ CONTEXT: PL/Python function "test_type_conversion_float4"
SELECT * FROM test_type_conversion_float4(-100);
INFO: (-100.0, <type 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float4"
test_type_conversion_float4
-----------------------------
-100
@ -304,7 +273,6 @@ CONTEXT: PL/Python function "test_type_conversion_float4"
SELECT * FROM test_type_conversion_float4(5000.5);
INFO: (5000.5, <type 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float4"
test_type_conversion_float4
-----------------------------
5000.5
@ -312,7 +280,6 @@ CONTEXT: PL/Python function "test_type_conversion_float4"
SELECT * FROM test_type_conversion_float4(null);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_float4"
test_type_conversion_float4
-----------------------------
@ -324,7 +291,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_float8(100);
INFO: (100.0, <type 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float8"
test_type_conversion_float8
-----------------------------
100
@ -332,7 +298,6 @@ CONTEXT: PL/Python function "test_type_conversion_float8"
SELECT * FROM test_type_conversion_float8(-100);
INFO: (-100.0, <type 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float8"
test_type_conversion_float8
-----------------------------
-100
@ -340,7 +305,6 @@ CONTEXT: PL/Python function "test_type_conversion_float8"
SELECT * FROM test_type_conversion_float8(5000000000.5);
INFO: (5000000000.5, <type 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float8"
test_type_conversion_float8
-----------------------------
5000000000.5
@ -348,7 +312,6 @@ CONTEXT: PL/Python function "test_type_conversion_float8"
SELECT * FROM test_type_conversion_float8(null);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_float8"
test_type_conversion_float8
-----------------------------
@ -356,7 +319,6 @@ CONTEXT: PL/Python function "test_type_conversion_float8"
SELECT * FROM test_type_conversion_float8(100100100.654321);
INFO: (100100100.654321, <type 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float8"
test_type_conversion_float8
-----------------------------
100100100.654321
@ -368,7 +330,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_oid(100);
INFO: (100L, <type 'long'>)
CONTEXT: PL/Python function "test_type_conversion_oid"
test_type_conversion_oid
--------------------------
100
@ -376,7 +337,6 @@ CONTEXT: PL/Python function "test_type_conversion_oid"
SELECT * FROM test_type_conversion_oid(2147483649);
INFO: (2147483649L, <type 'long'>)
CONTEXT: PL/Python function "test_type_conversion_oid"
test_type_conversion_oid
--------------------------
2147483649
@ -384,7 +344,6 @@ CONTEXT: PL/Python function "test_type_conversion_oid"
SELECT * FROM test_type_conversion_oid(null);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_oid"
test_type_conversion_oid
--------------------------
@ -396,7 +355,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_text('hello world');
INFO: ('hello world', <type 'str'>)
CONTEXT: PL/Python function "test_type_conversion_text"
test_type_conversion_text
---------------------------
hello world
@ -404,7 +362,6 @@ CONTEXT: PL/Python function "test_type_conversion_text"
SELECT * FROM test_type_conversion_text(null);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_text"
test_type_conversion_text
---------------------------
@ -416,7 +373,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_bytea('hello world');
INFO: ('hello world', <type 'str'>)
CONTEXT: PL/Python function "test_type_conversion_bytea"
test_type_conversion_bytea
----------------------------
\x68656c6c6f20776f726c64
@ -424,7 +380,6 @@ CONTEXT: PL/Python function "test_type_conversion_bytea"
SELECT * FROM test_type_conversion_bytea(E'null\\000byte');
INFO: ('null\x00byte', <type 'str'>)
CONTEXT: PL/Python function "test_type_conversion_bytea"
test_type_conversion_bytea
----------------------------
\x6e756c6c0062797465
@ -432,7 +387,6 @@ CONTEXT: PL/Python function "test_type_conversion_bytea"
SELECT * FROM test_type_conversion_bytea(null);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_bytea"
test_type_conversion_bytea
----------------------------
@ -481,7 +435,6 @@ return y
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_uint2(100::uint2, 50);
INFO: (100, <type 'int'>)
CONTEXT: PL/Python function "test_type_conversion_uint2"
test_type_conversion_uint2
----------------------------
50
@ -489,13 +442,11 @@ CONTEXT: PL/Python function "test_type_conversion_uint2"
SELECT * FROM test_type_conversion_uint2(100::uint2, -50);
INFO: (100, <type 'int'>)
CONTEXT: PL/Python function "test_type_conversion_uint2"
ERROR: value for domain uint2 violates check constraint "uint2_check"
CONTEXT: while creating return value
PL/Python function "test_type_conversion_uint2"
SELECT * FROM test_type_conversion_uint2(null, 1);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_uint2"
test_type_conversion_uint2
----------------------------
1
@ -524,7 +475,6 @@ return y
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_bytea10('hello wold', 'hello wold');
INFO: ('hello wold', <type 'str'>)
CONTEXT: PL/Python function "test_type_conversion_bytea10"
test_type_conversion_bytea10
------------------------------
\x68656c6c6f20776f6c64
@ -534,7 +484,6 @@ SELECT * FROM test_type_conversion_bytea10('hello world', 'hello wold');
ERROR: value for domain bytea10 violates check constraint "bytea10_check"
SELECT * FROM test_type_conversion_bytea10('hello word', 'hello world');
INFO: ('hello word', <type 'str'>)
CONTEXT: PL/Python function "test_type_conversion_bytea10"
ERROR: value for domain bytea10 violates check constraint "bytea10_check"
CONTEXT: while creating return value
PL/Python function "test_type_conversion_bytea10"
@ -542,7 +491,6 @@ SELECT * FROM test_type_conversion_bytea10(null, 'hello word');
ERROR: value for domain bytea10 violates check constraint "bytea10_check"
SELECT * FROM test_type_conversion_bytea10('hello word', null);
INFO: ('hello word', <type 'str'>)
CONTEXT: PL/Python function "test_type_conversion_bytea10"
ERROR: value for domain bytea10 violates check constraint "bytea10_check"
CONTEXT: while creating return value
PL/Python function "test_type_conversion_bytea10"
@ -555,7 +503,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_array_int4(ARRAY[0, 100]);
INFO: ([0, 100], <type 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_int4"
test_type_conversion_array_int4
---------------------------------
{0,100}
@ -563,7 +510,6 @@ CONTEXT: PL/Python function "test_type_conversion_array_int4"
SELECT * FROM test_type_conversion_array_int4(ARRAY[0,-100,55]);
INFO: ([0, -100, 55], <type 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_int4"
test_type_conversion_array_int4
---------------------------------
{0,-100,55}
@ -571,7 +517,6 @@ CONTEXT: PL/Python function "test_type_conversion_array_int4"
SELECT * FROM test_type_conversion_array_int4(ARRAY[NULL,1]);
INFO: ([None, 1], <type 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_int4"
test_type_conversion_array_int4
---------------------------------
{NULL,1}
@ -579,7 +524,6 @@ CONTEXT: PL/Python function "test_type_conversion_array_int4"
SELECT * FROM test_type_conversion_array_int4(ARRAY[]::integer[]);
INFO: ([], <type 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_int4"
test_type_conversion_array_int4
---------------------------------
{}
@ -587,7 +531,6 @@ CONTEXT: PL/Python function "test_type_conversion_array_int4"
SELECT * FROM test_type_conversion_array_int4(NULL);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_array_int4"
test_type_conversion_array_int4
---------------------------------
@ -603,7 +546,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_array_text(ARRAY['foo', 'bar']);
INFO: (['foo', 'bar'], <type 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_text"
test_type_conversion_array_text
---------------------------------
{foo,bar}
@ -615,7 +557,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_array_bytea(ARRAY[E'\\xdeadbeef'::bytea, NULL]);
INFO: (['\xde\xad\xbe\xef', None], <type 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_bytea"
test_type_conversion_array_bytea
----------------------------------
{"\\xdeadbeef",NULL}
@ -681,7 +622,6 @@ return x
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_array_domain(ARRAY[0, 100]::ordered_pair_domain);
INFO: ([0, 100], <type 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_domain"
test_type_conversion_array_domain
-----------------------------------
{0,100}
@ -689,7 +629,6 @@ CONTEXT: PL/Python function "test_type_conversion_array_domain"
SELECT * FROM test_type_conversion_array_domain(NULL::ordered_pair_domain);
INFO: (None, <type 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_array_domain"
test_type_conversion_array_domain
-----------------------------------
@ -783,7 +722,6 @@ return rv[0]['val']
$$;
SELECT test_prep_bool_output(); -- false
INFO: {'val': False}
CONTEXT: PL/Python function "test_prep_bool_output"
test_prep_bool_output
-----------------------
f
@ -812,7 +750,6 @@ return rv[0]['val']
$$;
SELECT test_prep_bytea_output();
INFO: {'val': '\xaa\x00\xbb'}
CONTEXT: PL/Python function "test_prep_bytea_output"
test_prep_bytea_output
------------------------
\xaa00bb

View File

@ -10,7 +10,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_bool(true);
INFO: (True, <class 'bool'>)
CONTEXT: PL/Python function "test_type_conversion_bool"
test_type_conversion_bool
---------------------------
t
@ -18,7 +17,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool"
SELECT * FROM test_type_conversion_bool(false);
INFO: (False, <class 'bool'>)
CONTEXT: PL/Python function "test_type_conversion_bool"
test_type_conversion_bool
---------------------------
f
@ -26,7 +24,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool"
SELECT * FROM test_type_conversion_bool(null);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_bool"
test_type_conversion_bool
---------------------------
@ -54,7 +51,6 @@ return ret
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_bool_other(0);
INFO: (0, False)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
f
@ -62,7 +58,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool_other"
SELECT * FROM test_type_conversion_bool_other(1);
INFO: (5, True)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
t
@ -70,7 +65,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool_other"
SELECT * FROM test_type_conversion_bool_other(2);
INFO: ('', False)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
f
@ -78,7 +72,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool_other"
SELECT * FROM test_type_conversion_bool_other(3);
INFO: ('fa', True)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
t
@ -86,7 +79,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool_other"
SELECT * FROM test_type_conversion_bool_other(4);
INFO: ([], False)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
f
@ -94,7 +86,6 @@ CONTEXT: PL/Python function "test_type_conversion_bool_other"
SELECT * FROM test_type_conversion_bool_other(5);
INFO: ([0], True)
CONTEXT: PL/Python function "test_type_conversion_bool_other"
test_type_conversion_bool_other
---------------------------------
t
@ -106,7 +97,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_char('a');
INFO: ('a', <class 'str'>)
CONTEXT: PL/Python function "test_type_conversion_char"
test_type_conversion_char
---------------------------
a
@ -114,7 +104,6 @@ CONTEXT: PL/Python function "test_type_conversion_char"
SELECT * FROM test_type_conversion_char(null);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_char"
test_type_conversion_char
---------------------------
@ -126,7 +115,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_int2(100::int2);
INFO: (100, <class 'int'>)
CONTEXT: PL/Python function "test_type_conversion_int2"
test_type_conversion_int2
---------------------------
100
@ -134,7 +122,6 @@ CONTEXT: PL/Python function "test_type_conversion_int2"
SELECT * FROM test_type_conversion_int2(-100::int2);
INFO: (-100, <class 'int'>)
CONTEXT: PL/Python function "test_type_conversion_int2"
test_type_conversion_int2
---------------------------
-100
@ -142,7 +129,6 @@ CONTEXT: PL/Python function "test_type_conversion_int2"
SELECT * FROM test_type_conversion_int2(null);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_int2"
test_type_conversion_int2
---------------------------
@ -154,7 +140,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_int4(100);
INFO: (100, <class 'int'>)
CONTEXT: PL/Python function "test_type_conversion_int4"
test_type_conversion_int4
---------------------------
100
@ -162,7 +147,6 @@ CONTEXT: PL/Python function "test_type_conversion_int4"
SELECT * FROM test_type_conversion_int4(-100);
INFO: (-100, <class 'int'>)
CONTEXT: PL/Python function "test_type_conversion_int4"
test_type_conversion_int4
---------------------------
-100
@ -170,7 +154,6 @@ CONTEXT: PL/Python function "test_type_conversion_int4"
SELECT * FROM test_type_conversion_int4(null);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_int4"
test_type_conversion_int4
---------------------------
@ -182,7 +165,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_int8(100);
INFO: (100, <class 'int'>)
CONTEXT: PL/Python function "test_type_conversion_int8"
test_type_conversion_int8
---------------------------
100
@ -190,7 +172,6 @@ CONTEXT: PL/Python function "test_type_conversion_int8"
SELECT * FROM test_type_conversion_int8(-100);
INFO: (-100, <class 'int'>)
CONTEXT: PL/Python function "test_type_conversion_int8"
test_type_conversion_int8
---------------------------
-100
@ -198,7 +179,6 @@ CONTEXT: PL/Python function "test_type_conversion_int8"
SELECT * FROM test_type_conversion_int8(5000000000);
INFO: (5000000000, <class 'int'>)
CONTEXT: PL/Python function "test_type_conversion_int8"
test_type_conversion_int8
---------------------------
5000000000
@ -206,7 +186,6 @@ CONTEXT: PL/Python function "test_type_conversion_int8"
SELECT * FROM test_type_conversion_int8(null);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_int8"
test_type_conversion_int8
---------------------------
@ -220,7 +199,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_numeric(100);
INFO: ('100', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
100
@ -228,7 +206,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(-100);
INFO: ('-100', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
-100
@ -236,7 +213,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(100.0);
INFO: ('100.0', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
100.0
@ -244,7 +220,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(100.00);
INFO: ('100.00', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
100.00
@ -252,7 +227,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(5000000000.5);
INFO: ('5000000000.5', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
5000000000.5
@ -260,7 +234,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(1234567890.0987654321);
INFO: ('1234567890.0987654321', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
1234567890.0987654321
@ -268,7 +241,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(-1234567890.0987654321);
INFO: ('-1234567890.0987654321', 'Decimal')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
-1234567890.0987654321
@ -276,7 +248,6 @@ CONTEXT: PL/Python function "test_type_conversion_numeric"
SELECT * FROM test_type_conversion_numeric(null);
INFO: ('None', 'NoneType')
CONTEXT: PL/Python function "test_type_conversion_numeric"
test_type_conversion_numeric
------------------------------
@ -288,7 +259,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_float4(100);
INFO: (100.0, <class 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float4"
test_type_conversion_float4
-----------------------------
100
@ -296,7 +266,6 @@ CONTEXT: PL/Python function "test_type_conversion_float4"
SELECT * FROM test_type_conversion_float4(-100);
INFO: (-100.0, <class 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float4"
test_type_conversion_float4
-----------------------------
-100
@ -304,7 +273,6 @@ CONTEXT: PL/Python function "test_type_conversion_float4"
SELECT * FROM test_type_conversion_float4(5000.5);
INFO: (5000.5, <class 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float4"
test_type_conversion_float4
-----------------------------
5000.5
@ -312,7 +280,6 @@ CONTEXT: PL/Python function "test_type_conversion_float4"
SELECT * FROM test_type_conversion_float4(null);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_float4"
test_type_conversion_float4
-----------------------------
@ -324,7 +291,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_float8(100);
INFO: (100.0, <class 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float8"
test_type_conversion_float8
-----------------------------
100
@ -332,7 +298,6 @@ CONTEXT: PL/Python function "test_type_conversion_float8"
SELECT * FROM test_type_conversion_float8(-100);
INFO: (-100.0, <class 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float8"
test_type_conversion_float8
-----------------------------
-100
@ -340,7 +305,6 @@ CONTEXT: PL/Python function "test_type_conversion_float8"
SELECT * FROM test_type_conversion_float8(5000000000.5);
INFO: (5000000000.5, <class 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float8"
test_type_conversion_float8
-----------------------------
5000000000.5
@ -348,7 +312,6 @@ CONTEXT: PL/Python function "test_type_conversion_float8"
SELECT * FROM test_type_conversion_float8(null);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_float8"
test_type_conversion_float8
-----------------------------
@ -356,7 +319,6 @@ CONTEXT: PL/Python function "test_type_conversion_float8"
SELECT * FROM test_type_conversion_float8(100100100.654321);
INFO: (100100100.654321, <class 'float'>)
CONTEXT: PL/Python function "test_type_conversion_float8"
test_type_conversion_float8
-----------------------------
100100100.654321
@ -368,7 +330,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_oid(100);
INFO: (100, <class 'int'>)
CONTEXT: PL/Python function "test_type_conversion_oid"
test_type_conversion_oid
--------------------------
100
@ -376,7 +337,6 @@ CONTEXT: PL/Python function "test_type_conversion_oid"
SELECT * FROM test_type_conversion_oid(2147483649);
INFO: (2147483649, <class 'int'>)
CONTEXT: PL/Python function "test_type_conversion_oid"
test_type_conversion_oid
--------------------------
2147483649
@ -384,7 +344,6 @@ CONTEXT: PL/Python function "test_type_conversion_oid"
SELECT * FROM test_type_conversion_oid(null);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_oid"
test_type_conversion_oid
--------------------------
@ -396,7 +355,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_text('hello world');
INFO: ('hello world', <class 'str'>)
CONTEXT: PL/Python function "test_type_conversion_text"
test_type_conversion_text
---------------------------
hello world
@ -404,7 +362,6 @@ CONTEXT: PL/Python function "test_type_conversion_text"
SELECT * FROM test_type_conversion_text(null);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_text"
test_type_conversion_text
---------------------------
@ -416,7 +373,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_bytea('hello world');
INFO: (b'hello world', <class 'bytes'>)
CONTEXT: PL/Python function "test_type_conversion_bytea"
test_type_conversion_bytea
----------------------------
\x68656c6c6f20776f726c64
@ -424,7 +380,6 @@ CONTEXT: PL/Python function "test_type_conversion_bytea"
SELECT * FROM test_type_conversion_bytea(E'null\\000byte');
INFO: (b'null\x00byte', <class 'bytes'>)
CONTEXT: PL/Python function "test_type_conversion_bytea"
test_type_conversion_bytea
----------------------------
\x6e756c6c0062797465
@ -432,7 +387,6 @@ CONTEXT: PL/Python function "test_type_conversion_bytea"
SELECT * FROM test_type_conversion_bytea(null);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_bytea"
test_type_conversion_bytea
----------------------------
@ -481,7 +435,6 @@ return y
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_uint2(100::uint2, 50);
INFO: (100, <class 'int'>)
CONTEXT: PL/Python function "test_type_conversion_uint2"
test_type_conversion_uint2
----------------------------
50
@ -489,13 +442,11 @@ CONTEXT: PL/Python function "test_type_conversion_uint2"
SELECT * FROM test_type_conversion_uint2(100::uint2, -50);
INFO: (100, <class 'int'>)
CONTEXT: PL/Python function "test_type_conversion_uint2"
ERROR: value for domain uint2 violates check constraint "uint2_check"
CONTEXT: while creating return value
PL/Python function "test_type_conversion_uint2"
SELECT * FROM test_type_conversion_uint2(null, 1);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_uint2"
test_type_conversion_uint2
----------------------------
1
@ -524,7 +475,6 @@ return y
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_bytea10('hello wold', 'hello wold');
INFO: (b'hello wold', <class 'bytes'>)
CONTEXT: PL/Python function "test_type_conversion_bytea10"
test_type_conversion_bytea10
------------------------------
\x68656c6c6f20776f6c64
@ -534,7 +484,6 @@ SELECT * FROM test_type_conversion_bytea10('hello world', 'hello wold');
ERROR: value for domain bytea10 violates check constraint "bytea10_check"
SELECT * FROM test_type_conversion_bytea10('hello word', 'hello world');
INFO: (b'hello word', <class 'bytes'>)
CONTEXT: PL/Python function "test_type_conversion_bytea10"
ERROR: value for domain bytea10 violates check constraint "bytea10_check"
CONTEXT: while creating return value
PL/Python function "test_type_conversion_bytea10"
@ -542,7 +491,6 @@ SELECT * FROM test_type_conversion_bytea10(null, 'hello word');
ERROR: value for domain bytea10 violates check constraint "bytea10_check"
SELECT * FROM test_type_conversion_bytea10('hello word', null);
INFO: (b'hello word', <class 'bytes'>)
CONTEXT: PL/Python function "test_type_conversion_bytea10"
ERROR: value for domain bytea10 violates check constraint "bytea10_check"
CONTEXT: while creating return value
PL/Python function "test_type_conversion_bytea10"
@ -555,7 +503,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_array_int4(ARRAY[0, 100]);
INFO: ([0, 100], <class 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_int4"
test_type_conversion_array_int4
---------------------------------
{0,100}
@ -563,7 +510,6 @@ CONTEXT: PL/Python function "test_type_conversion_array_int4"
SELECT * FROM test_type_conversion_array_int4(ARRAY[0,-100,55]);
INFO: ([0, -100, 55], <class 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_int4"
test_type_conversion_array_int4
---------------------------------
{0,-100,55}
@ -571,7 +517,6 @@ CONTEXT: PL/Python function "test_type_conversion_array_int4"
SELECT * FROM test_type_conversion_array_int4(ARRAY[NULL,1]);
INFO: ([None, 1], <class 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_int4"
test_type_conversion_array_int4
---------------------------------
{NULL,1}
@ -579,7 +524,6 @@ CONTEXT: PL/Python function "test_type_conversion_array_int4"
SELECT * FROM test_type_conversion_array_int4(ARRAY[]::integer[]);
INFO: ([], <class 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_int4"
test_type_conversion_array_int4
---------------------------------
{}
@ -587,7 +531,6 @@ CONTEXT: PL/Python function "test_type_conversion_array_int4"
SELECT * FROM test_type_conversion_array_int4(NULL);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_array_int4"
test_type_conversion_array_int4
---------------------------------
@ -603,7 +546,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_array_text(ARRAY['foo', 'bar']);
INFO: (['foo', 'bar'], <class 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_text"
test_type_conversion_array_text
---------------------------------
{foo,bar}
@ -615,7 +557,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_array_bytea(ARRAY[E'\\xdeadbeef'::bytea, NULL]);
INFO: ([b'\xde\xad\xbe\xef', None], <class 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_bytea"
test_type_conversion_array_bytea
----------------------------------
{"\\xdeadbeef",NULL}
@ -681,7 +622,6 @@ return x
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_array_domain(ARRAY[0, 100]::ordered_pair_domain);
INFO: ([0, 100], <class 'list'>)
CONTEXT: PL/Python function "test_type_conversion_array_domain"
test_type_conversion_array_domain
-----------------------------------
{0,100}
@ -689,7 +629,6 @@ CONTEXT: PL/Python function "test_type_conversion_array_domain"
SELECT * FROM test_type_conversion_array_domain(NULL::ordered_pair_domain);
INFO: (None, <class 'NoneType'>)
CONTEXT: PL/Python function "test_type_conversion_array_domain"
test_type_conversion_array_domain
-----------------------------------
@ -783,7 +722,6 @@ return rv[0]['val']
$$;
SELECT test_prep_bool_output(); -- false
INFO: {'val': False}
CONTEXT: PL/Python function "test_prep_bool_output"
test_prep_bool_output
-----------------------
f
@ -812,7 +750,6 @@ return rv[0]['val']
$$;
SELECT test_prep_bytea_output();
INFO: {'val': b'\xaa\x00\xbb'}
CONTEXT: PL/Python function "test_prep_bytea_output"
test_prep_bytea_output
------------------------
\xaa00bb

View File

@ -447,12 +447,9 @@ Check constraints:
copy check_con_tbl from stdin;
NOTICE: input = {"f1":1}
CONTEXT: COPY check_con_tbl, line 1: "1"
NOTICE: input = {"f1":null}
CONTEXT: COPY check_con_tbl, line 2: "\N"
copy check_con_tbl from stdin;
NOTICE: input = {"f1":0}
CONTEXT: COPY check_con_tbl, line 1: "0"
ERROR: new row for relation "check_con_tbl" violates check constraint "check_con_tbl_check"
DETAIL: Failing row contains (0).
CONTEXT: COPY check_con_tbl, line 1: "0"

View File

@ -234,15 +234,10 @@ drop cascades to table schema_one.table_one
drop cascades to table schema_one."table two"
drop cascades to table schema_one.table_three
NOTICE: table "schema_two_table_two" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_two"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
NOTICE: table "audit_tbls_schema_two_table_three" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.audit_tbls_schema_two_table_three"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_three"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
ERROR: object audit_tbls.schema_two_table_three of type table cannot be dropped
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_three"
CONTEXT: PL/pgSQL function undroppable() line 14 at RAISE
SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_three"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
DELETE FROM undroppable_objs WHERE object_identity = 'audit_tbls.schema_two_table_three';
DROP SCHEMA schema_one, schema_two CASCADE;
@ -255,23 +250,12 @@ drop cascades to table schema_one.table_one
drop cascades to table schema_one."table two"
drop cascades to table schema_one.table_three
NOTICE: table "schema_two_table_two" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_two"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
NOTICE: table "audit_tbls_schema_two_table_three" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.audit_tbls_schema_two_table_three"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_three"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
NOTICE: table "schema_one_table_one" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_one_table_one"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
NOTICE: table "schema_one_table two" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls."schema_one_table two""
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
NOTICE: table "schema_one_table_three" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_one_table_three"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
ERROR: object schema_one.table_three of type table cannot be dropped
CONTEXT: PL/pgSQL function undroppable() line 14 at RAISE
DELETE FROM undroppable_objs WHERE object_identity = 'schema_one.table_three';
DROP SCHEMA schema_one, schema_two CASCADE;
NOTICE: drop cascades to 7 other objects
@ -283,22 +267,10 @@ drop cascades to table schema_one.table_one
drop cascades to table schema_one."table two"
drop cascades to table schema_one.table_three
NOTICE: table "schema_two_table_two" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_two"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
NOTICE: table "audit_tbls_schema_two_table_three" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.audit_tbls_schema_two_table_three"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_two_table_three"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
NOTICE: table "schema_one_table_one" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_one_table_one"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
NOTICE: table "schema_one_table two" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls."schema_one_table two""
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
NOTICE: table "schema_one_table_three" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.schema_one_table_three"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
SELECT * FROM dropped_objects WHERE schema IS NULL OR schema <> 'pg_toast';
type | schema | object
--------------+------------+-------------------------------------
@ -329,8 +301,6 @@ SELECT * FROM dropped_objects WHERE schema IS NULL OR schema <> 'pg_toast';
DROP OWNED BY regression_bob;
NOTICE: schema "audit_tbls" does not exist, skipping
CONTEXT: SQL statement "DROP TABLE IF EXISTS audit_tbls.audit_tbls_schema_one_table_two"
PL/pgSQL function test_evtrig_dropped_objects() line 8 at EXECUTE
SELECT * FROM dropped_objects WHERE type = 'schema';
type | schema | object
--------+--------+------------
@ -392,7 +362,7 @@ ERROR: pg_event_trigger_table_rewrite_oid() can only be called in a table_rewri
CREATE OR REPLACE FUNCTION test_evtrig_no_rewrite() RETURNS event_trigger
LANGUAGE plpgsql AS $$
BEGIN
RAISE EXCEPTION 'I''m sorry Sir, No Rewrite Allowed.';
RAISE EXCEPTION 'rewrites not allowed';
END;
$$;
create event trigger no_rewrite_allowed on table_rewrite
@ -401,9 +371,11 @@ create table rewriteme (id serial primary key, foo float);
insert into rewriteme
select x * 1.001 from generate_series(1, 500) as t(x);
alter table rewriteme alter column foo type numeric;
ERROR: I'm sorry Sir, No Rewrite Allowed.
ERROR: rewrites not allowed
CONTEXT: PL/pgSQL function test_evtrig_no_rewrite() line 3 at RAISE
alter table rewriteme add column baz int default 0;
ERROR: I'm sorry Sir, No Rewrite Allowed.
ERROR: rewrites not allowed
CONTEXT: PL/pgSQL function test_evtrig_no_rewrite() line 3 at RAISE
-- test with more than one reason to rewrite a single table
CREATE OR REPLACE FUNCTION test_evtrig_no_rewrite() RETURNS event_trigger
LANGUAGE plpgsql AS $$

View File

@ -234,8 +234,6 @@ begin
end$$ language plpgsql;
select cachebug();
NOTICE: table "temptable" does not exist, skipping
CONTEXT: SQL statement "drop table if exists temptable cascade"
PL/pgSQL function cachebug() line 4 at SQL statement
NOTICE: 1
NOTICE: 2
NOTICE: 3
@ -246,8 +244,6 @@ NOTICE: 3
select cachebug();
NOTICE: drop cascades to view vv
CONTEXT: SQL statement "drop table if exists temptable cascade"
PL/pgSQL function cachebug() line 4 at SQL statement
NOTICE: 1
NOTICE: 2
NOTICE: 3

View File

@ -1518,27 +1518,35 @@ ERROR: duplicate key value violates unique constraint "pfield_name"
DETAIL: Key (name)=(PF1_1) already exists.
update PSlot set backlink = 'WS.not.there' where slotname = 'PS.base.a1';
ERROR: WS.not.there does not exist
CONTEXT: PL/pgSQL function tg_backlink_a() line 17 at assignment
CONTEXT: PL/pgSQL function tg_backlink_set(character,character) line 30 at RAISE
PL/pgSQL function tg_backlink_a() line 17 at assignment
update PSlot set backlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal backlink beginning with XX
CONTEXT: PL/pgSQL function tg_backlink_a() line 17 at assignment
CONTEXT: PL/pgSQL function tg_backlink_set(character,character) line 47 at RAISE
PL/pgSQL function tg_backlink_a() line 17 at assignment
update PSlot set slotlink = 'PS.not.there' where slotname = 'PS.base.a1';
ERROR: PS.not.there does not exist
CONTEXT: PL/pgSQL function tg_slotlink_a() line 17 at assignment
CONTEXT: PL/pgSQL function tg_slotlink_set(character,character) line 30 at RAISE
PL/pgSQL function tg_slotlink_a() line 17 at assignment
update PSlot set slotlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal slotlink beginning with XX
CONTEXT: PL/pgSQL function tg_slotlink_a() line 17 at assignment
CONTEXT: PL/pgSQL function tg_slotlink_set(character,character) line 77 at RAISE
PL/pgSQL function tg_slotlink_a() line 17 at assignment
insert into HSlot values ('HS', 'base.hub1', 1, '');
ERROR: duplicate key value violates unique constraint "hslot_name"
DETAIL: Key (slotname)=(HS.base.hub1.1 ) already exists.
insert into HSlot values ('HS', 'base.hub1', 20, '');
ERROR: no manual manipulation of HSlot
CONTEXT: PL/pgSQL function tg_hslot_biu() line 12 at RAISE
delete from HSlot;
ERROR: no manual manipulation of HSlot
CONTEXT: PL/pgSQL function tg_hslot_bd() line 12 at RAISE
insert into IFace values ('IF', 'notthere', 'eth0', '');
ERROR: system "notthere" does not exist
CONTEXT: PL/pgSQL function tg_iface_biu() line 8 at RAISE
insert into IFace values ('IF', 'orion', 'ethernet_interface_name_too_long', '');
ERROR: IFace slotname "IF.orion.ethernet_interface_name_too_long" too long (20 char max)
CONTEXT: PL/pgSQL function tg_iface_biu() line 14 at RAISE
--
-- The following tests are unrelated to the scenario outlined above;
-- they merely exercise specific parts of PL/pgSQL
@ -1963,6 +1971,7 @@ NOTICE: should see this
NOTICE: should see this only if -100 <> 0
NOTICE: should see this only if -100 fits in smallint
ERROR: -100 is less than zero
CONTEXT: PL/pgSQL function trap_zero_divide(integer) line 12 at RAISE
create function trap_matching_test(int) returns int as $$
declare x int;
sx smallint;
@ -2066,14 +2075,8 @@ begin
end$$ language plpgsql;
select test_variable_storage();
NOTICE: should see this
CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
PL/pgSQL function test_variable_storage() line 8 at PERFORM
NOTICE: should see this only if -100 <> 0
CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
PL/pgSQL function test_variable_storage() line 8 at PERFORM
NOTICE: should see this only if -100 fits in smallint
CONTEXT: SQL statement "SELECT trap_zero_divide(-100)"
PL/pgSQL function test_variable_storage() line 8 at PERFORM
test_variable_storage
-----------------------
123456789012
@ -4103,6 +4106,7 @@ DETAIL: some detail info
HINT: some hint
ERROR: 1 2 3
DETAIL: some detail info
CONTEXT: PL/pgSQL function raise_test() line 5 at RAISE
-- Since we can't actually see the thrown SQLSTATE in default psql output,
-- test it like this; this also tests re-RAISE
create or replace function raise_test() returns void as $$
@ -4119,6 +4123,7 @@ select raise_test();
NOTICE: SQLSTATE: 22012 SQLERRM: check me
ERROR: check me
DETAIL: some detail info
CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise 'check me'
@ -4133,6 +4138,7 @@ select raise_test();
NOTICE: SQLSTATE: 1234F SQLERRM: check me
ERROR: check me
DETAIL: some detail info
CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
-- SQLSTATE specification in WHEN
create or replace function raise_test() returns void as $$
begin
@ -4148,6 +4154,7 @@ select raise_test();
NOTICE: SQLSTATE: 1234F SQLERRM: check me
ERROR: check me
DETAIL: some detail info
CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise division_by_zero using detail = 'some detail info';
@ -4161,6 +4168,7 @@ select raise_test();
NOTICE: SQLSTATE: 22012 SQLERRM: division_by_zero
ERROR: division_by_zero
DETAIL: some detail info
CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise division_by_zero;
@ -4168,6 +4176,7 @@ end;
$$ language plpgsql;
select raise_test();
ERROR: division_by_zero
CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise sqlstate '1234F';
@ -4175,6 +4184,7 @@ end;
$$ language plpgsql;
select raise_test();
ERROR: 1234F
CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise division_by_zero using message = 'custom' || ' message';
@ -4182,6 +4192,7 @@ end;
$$ language plpgsql;
select raise_test();
ERROR: custom message
CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
create or replace function raise_test() returns void as $$
begin
raise using message = 'custom' || ' message', errcode = '22012';
@ -4189,6 +4200,7 @@ end;
$$ language plpgsql;
select raise_test();
ERROR: custom message
CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
-- conflict on message
create or replace function raise_test() returns void as $$
begin
@ -4305,6 +4317,7 @@ $$ language plpgsql;
select raise_test();
NOTICE: 22012
ERROR: substitute message
CONTEXT: PL/pgSQL function raise_test() line 7 at RAISE
drop function raise_test();
-- test passing column_name, constraint_name, datatype_name, table_name
-- and schema_name error fields
@ -4864,7 +4877,6 @@ LINE 1: SELECT 'foo\\bar\041baz'
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
QUERY: SELECT 'foo\\bar\041baz'
CONTEXT: PL/pgSQL function strtest() line 4 at RETURN
strtest
-------------
foo\bar!baz
@ -5380,22 +5392,14 @@ $$ language plpgsql;
select outer_outer_func(10);
NOTICE: calling down into outer_func()
NOTICE: calling down into inner_func()
CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 4 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 7 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: lets make sure we didnt break anything
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: inner_func() done
CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: outer_func() done
outer_outer_func
------------------
@ -5406,22 +5410,14 @@ NOTICE: outer_func() done
select outer_outer_func(20);
NOTICE: calling down into outer_func()
NOTICE: calling down into inner_func()
CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 4 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 7 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: lets make sure we didnt break anything
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: inner_func() done
CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: outer_func() done
outer_outer_func
------------------
@ -5478,22 +5474,14 @@ $$ language plpgsql;
select outer_outer_func(10);
NOTICE: calling down into outer_func()
NOTICE: calling down into inner_func()
CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 10 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 15 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: lets make sure we didnt break anything
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: inner_func() done
CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: outer_func() done
outer_outer_func
------------------
@ -5504,22 +5492,14 @@ NOTICE: outer_func() done
select outer_outer_func(20);
NOTICE: calling down into outer_func()
NOTICE: calling down into inner_func()
CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 10 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: ***PL/pgSQL function inner_func(integer) line 15 at GET DIAGNOSTICS
PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment***
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: lets make sure we didnt break anything
CONTEXT: PL/pgSQL function outer_func(integer) line 6 at assignment
PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: inner_func() done
CONTEXT: PL/pgSQL function outer_outer_func(integer) line 6 at assignment
NOTICE: outer_func() done
outer_outer_func
------------------

View File

@ -1023,7 +1023,6 @@ GRANT regressgroup2 TO regressuser5; -- fails: no ADMIN OPTION
ERROR: must have admin option on role "regressgroup2"
SELECT dogrant_ok(); -- ok: SECURITY DEFINER conveys ADMIN
NOTICE: role "regressuser5" is already a member of role "regressgroup2"
CONTEXT: SQL function "dogrant_ok" statement 1
dogrant_ok
------------

View File

@ -2332,3 +2332,31 @@ execute q;
<l|int >l|11
|====
deallocate q;
-- SHOW_CONTEXT
\set SHOW_CONTEXT never
do $$
begin
raise notice 'foo';
raise exception 'bar';
end $$;
NOTICE: foo
ERROR: bar
\set SHOW_CONTEXT errors
do $$
begin
raise notice 'foo';
raise exception 'bar';
end $$;
NOTICE: foo
ERROR: bar
CONTEXT: PL/pgSQL function inline_code_block line 4 at RAISE
\set SHOW_CONTEXT always
do $$
begin
raise notice 'foo';
raise exception 'bar';
end $$;
NOTICE: foo
CONTEXT: PL/pgSQL function inline_code_block line 3 at RAISE
ERROR: bar
CONTEXT: PL/pgSQL function inline_code_block line 4 at RAISE

View File

@ -1704,9 +1704,7 @@ create trigger tnoticetrigger after insert on tt for each row
execute procedure noticetrigger();
select insert_tt2('foolme','barme') limit 1;
NOTICE: noticetrigger 11 foolme
CONTEXT: SQL function "insert_tt2" statement 1
NOTICE: noticetrigger 12 barme
CONTEXT: SQL function "insert_tt2" statement 1
insert_tt2
------------
11
@ -1735,9 +1733,7 @@ create rule insert_tt_rule as on insert to tt do also
insert into tt_log values(new.*);
select insert_tt2('foollog','barlog') limit 1;
NOTICE: noticetrigger 13 foollog
CONTEXT: SQL function "insert_tt2" statement 1
NOTICE: noticetrigger 14 barlog
CONTEXT: SQL function "insert_tt2" statement 1
insert_tt2
------------
13

View File

@ -958,11 +958,7 @@ NOTICE: main_view BEFORE INSERT STATEMENT (before_view_ins_stmt)
NOTICE: main_view INSTEAD OF INSERT ROW (instead_of_ins)
NOTICE: NEW: (20,30)
NOTICE: trigger_func(before_ins_stmt) called: action = INSERT, when = BEFORE, level = STATEMENT
CONTEXT: SQL statement "INSERT INTO main_table VALUES (NEW.a, NEW.b)"
PL/pgSQL function view_trigger() line 17 at SQL statement
NOTICE: trigger_func(after_ins_stmt) called: action = INSERT, when = AFTER, level = STATEMENT
CONTEXT: SQL statement "INSERT INTO main_table VALUES (NEW.a, NEW.b)"
PL/pgSQL function view_trigger() line 17 at SQL statement
NOTICE: main_view AFTER INSERT STATEMENT (after_view_ins_stmt)
INSERT 0 1
INSERT INTO main_view VALUES (21, 31) RETURNING a, b;
@ -970,11 +966,7 @@ NOTICE: main_view BEFORE INSERT STATEMENT (before_view_ins_stmt)
NOTICE: main_view INSTEAD OF INSERT ROW (instead_of_ins)
NOTICE: NEW: (21,31)
NOTICE: trigger_func(before_ins_stmt) called: action = INSERT, when = BEFORE, level = STATEMENT
CONTEXT: SQL statement "INSERT INTO main_table VALUES (NEW.a, NEW.b)"
PL/pgSQL function view_trigger() line 17 at SQL statement
NOTICE: trigger_func(after_ins_stmt) called: action = INSERT, when = AFTER, level = STATEMENT
CONTEXT: SQL statement "INSERT INTO main_table VALUES (NEW.a, NEW.b)"
PL/pgSQL function view_trigger() line 17 at SQL statement
NOTICE: main_view AFTER INSERT STATEMENT (after_view_ins_stmt)
a | b
----+----
@ -988,17 +980,9 @@ NOTICE: main_view BEFORE UPDATE STATEMENT (before_view_upd_stmt)
NOTICE: main_view INSTEAD OF UPDATE ROW (instead_of_upd)
NOTICE: OLD: (20,30), NEW: (20,31)
NOTICE: trigger_func(before_upd_a_stmt) called: action = UPDATE, when = BEFORE, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(before_upd_a_row) called: action = UPDATE, when = BEFORE, level = ROW
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_stmt) called: action = UPDATE, when = AFTER, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_stmt) called: action = UPDATE, when = AFTER, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: main_view AFTER UPDATE STATEMENT (after_view_upd_stmt)
UPDATE 0
UPDATE main_view SET b = 32 WHERE a = 21 AND b = 31 RETURNING a, b;
@ -1006,17 +990,9 @@ NOTICE: main_view BEFORE UPDATE STATEMENT (before_view_upd_stmt)
NOTICE: main_view INSTEAD OF UPDATE ROW (instead_of_upd)
NOTICE: OLD: (21,31), NEW: (21,32)
NOTICE: trigger_func(before_upd_a_stmt) called: action = UPDATE, when = BEFORE, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(before_upd_a_row) called: action = UPDATE, when = BEFORE, level = ROW
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_stmt) called: action = UPDATE, when = AFTER, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_stmt) called: action = UPDATE, when = AFTER, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: main_view AFTER UPDATE STATEMENT (after_view_upd_stmt)
a | b
---+---
@ -1031,20 +1007,10 @@ NOTICE: main_view BEFORE UPDATE STATEMENT (before_view_upd_stmt)
NOTICE: main_view INSTEAD OF UPDATE ROW (instead_of_upd)
NOTICE: OLD: (20,30), NEW: (20,31)
NOTICE: trigger_func(before_upd_a_stmt) called: action = UPDATE, when = BEFORE, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_a_b_row) called: action = UPDATE, when = AFTER, level = ROW
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_row) called: action = UPDATE, when = AFTER, level = ROW
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_stmt) called: action = UPDATE, when = AFTER, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_stmt) called: action = UPDATE, when = AFTER, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: main_view AFTER UPDATE STATEMENT (after_view_upd_stmt)
UPDATE 1
UPDATE main_view SET b = 32 WHERE a = 21 AND b = 31 RETURNING a, b;
@ -1052,20 +1018,10 @@ NOTICE: main_view BEFORE UPDATE STATEMENT (before_view_upd_stmt)
NOTICE: main_view INSTEAD OF UPDATE ROW (instead_of_upd)
NOTICE: OLD: (21,31), NEW: (21,32)
NOTICE: trigger_func(before_upd_a_stmt) called: action = UPDATE, when = BEFORE, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_a_b_row) called: action = UPDATE, when = AFTER, level = ROW
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_row) called: action = UPDATE, when = AFTER, level = ROW
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_b_stmt) called: action = UPDATE, when = AFTER, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: trigger_func(after_upd_stmt) called: action = UPDATE, when = AFTER, level = STATEMENT
CONTEXT: SQL statement "UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b"
PL/pgSQL function view_trigger() line 23 at SQL statement
NOTICE: main_view AFTER UPDATE STATEMENT (after_view_upd_stmt)
a | b
----+----
@ -1277,6 +1233,7 @@ INSERT 0 1
-- UPDATE .. RETURNING
UPDATE city_view SET country_name = 'Japon' WHERE city_name = 'Tokyo'; -- error
ERROR: No such country: "Japon"
CONTEXT: PL/pgSQL function city_update() line 9 at RAISE
UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Takyo'; -- no match
UPDATE 0
UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Tokyo' RETURNING *; -- OK
@ -1489,26 +1446,13 @@ select pg_trigger_depth();
insert into depth_a values (1);
NOTICE: depth_a_tr: depth = 1
NOTICE: depth_b_tr: depth = 2
CONTEXT: SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_c_tr: depth = 3
CONTEXT: SQL statement "insert into depth_c values (1)"
PL/pgSQL function depth_b_tf() line 5 at EXECUTE
SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: SQLSTATE = U9999: depth = 2
CONTEXT: SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_b_tr: depth = 2
CONTEXT: SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_c_tr: depth = 3
CONTEXT: SQL statement "insert into depth_c values (1)"
PL/pgSQL function depth_b_tf() line 12 at EXECUTE
SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
ERROR: U9999
CONTEXT: SQL statement "insert into depth_c values (1)"
CONTEXT: PL/pgSQL function depth_c_tf() line 5 at RAISE
SQL statement "insert into depth_c values (1)"
PL/pgSQL function depth_b_tf() line 12 at EXECUTE
SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
@ -1521,21 +1465,9 @@ select pg_trigger_depth();
insert into depth_a values (2);
NOTICE: depth_a_tr: depth = 1
NOTICE: depth_b_tr: depth = 2
CONTEXT: SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_c_tr: depth = 3
CONTEXT: SQL statement "insert into depth_c values (2)"
PL/pgSQL function depth_b_tf() line 5 at EXECUTE
SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_c_tr: depth = 3
CONTEXT: SQL statement "insert into depth_c values (2)"
PL/pgSQL function depth_b_tf() line 5 at EXECUTE
SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_b_tr: depth = 2
CONTEXT: SQL statement "insert into depth_b values (new.id)"
PL/pgSQL function depth_a_tf() line 4 at SQL statement
NOTICE: depth_a_tr: depth = 1
select pg_trigger_depth();
pg_trigger_depth

View File

@ -934,7 +934,6 @@ SELECT xpath('/*', '<relativens xmlns=''relative''/>');
WARNING: line 1: xmlns: URI relative is not absolute
<relativens xmlns='relative'/>
^
CONTEXT: SQL function "xpath" statement 1
xpath
--------------------------------------
{"<relativens xmlns=\"relative\"/>"}

View File

@ -282,7 +282,7 @@ select pg_event_trigger_table_rewrite_oid();
CREATE OR REPLACE FUNCTION test_evtrig_no_rewrite() RETURNS event_trigger
LANGUAGE plpgsql AS $$
BEGIN
RAISE EXCEPTION 'I''m sorry Sir, No Rewrite Allowed.';
RAISE EXCEPTION 'rewrites not allowed';
END;
$$;

View File

@ -301,3 +301,26 @@ execute q;
execute q;
deallocate q;
-- SHOW_CONTEXT
\set SHOW_CONTEXT never
do $$
begin
raise notice 'foo';
raise exception 'bar';
end $$;
\set SHOW_CONTEXT errors
do $$
begin
raise notice 'foo';
raise exception 'bar';
end $$;
\set SHOW_CONTEXT always
do $$
begin
raise notice 'foo';
raise exception 'bar';
end $$;