Commit 0426f349 authored by Tom Lane's avatar Tom Lane

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
parent c80b5f66
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"}');
......
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"}');
......
......@@ -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
---+---------------------------------
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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>
......
......@@ -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>
......
......@@ -2029,6 +2029,7 @@ SyncVariables(void)
/* send stuff to it, too */
PQsetErrorVerbosity(pset.db, pset.verbosity);
PQsetErrorContextVisibility(pset.db, pset.show_context);
}
/*
......
......@@ -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"));
......
......@@ -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;
......
......@@ -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);
}
......@@ -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 *));
......
......@@ -169,3 +169,4 @@ PQsslInUse 166
PQsslStruct 167
PQsslAttributes 168
PQsslAttribute 169
PQsetErrorContextVisibility 170
......@@ -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)
{
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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 */
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......@@ -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.
......
......@@ -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)
......
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):
......
......@@ -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
--------------------
......
......@@ -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
--------------------
......
......@@ -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
--------------------
......
......@@ -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
-------------------
......
......@@ -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
------------------------------------
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
This diff is collapsed.
......@@ -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"
......
......@@ -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 $$
......
......@@ -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
......
This diff is collapsed.
......@@ -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
------------
......
......@@ -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
......@@ -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
......
......@@ -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
......
......@@ -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\"/>"}
......
......@@ -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;
$$;
......
......@@ -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 $$;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment