Commit 3d2aed66 authored by Tom Lane's avatar Tom Lane

Avoid using unsafe search_path settings during dump and restore.

Historically, pg_dump has "set search_path = foo, pg_catalog" when
dumping an object in schema "foo", and has also caused that setting
to be used while restoring the object.  This is problematic because
functions and operators in schema "foo" could capture references meant
to refer to pg_catalog entries, both in the queries issued by pg_dump
and those issued during the subsequent restore run.  That could
result in dump/restore misbehavior, or in privilege escalation if a
nefarious user installs trojan-horse functions or operators.

This patch changes pg_dump so that it does not change the search_path
dynamically.  The emitted restore script sets the search_path to what
was used at dump time, and then leaves it alone thereafter.  Created
objects are placed in the correct schema, regardless of the active
search_path, by dint of schema-qualifying their names in the CREATE
commands, as well as in subsequent ALTER and ALTER-like commands.

Since this change requires a change in the behavior of pg_restore
when processing an archive file made according to this new convention,
bump the archive file version number; old versions of pg_restore will
therefore refuse to process files made with new versions of pg_dump.

Security: CVE-2018-1058
parent 3bf05e09
......@@ -86,15 +86,17 @@
#define PRETTYINDENT_LIMIT 40 /* wrap limit */
/* Pretty flags */
#define PRETTYFLAG_PAREN 1
#define PRETTYFLAG_INDENT 2
#define PRETTYFLAG_PAREN 0x0001
#define PRETTYFLAG_INDENT 0x0002
#define PRETTYFLAG_SCHEMA 0x0004
/* Default line length for pretty-print wrapping: 0 means wrap always */
#define WRAP_COLUMN_DEFAULT 0
/* macro to test if pretty action needed */
/* macros to test if pretty action needed */
#define PRETTY_PAREN(context) ((context)->prettyFlags & PRETTYFLAG_PAREN)
#define PRETTY_INDENT(context) ((context)->prettyFlags & PRETTYFLAG_INDENT)
#define PRETTY_SCHEMA(context) ((context)->prettyFlags & PRETTYFLAG_SCHEMA)
/* ----------
......@@ -499,7 +501,7 @@ pg_get_ruledef_ext(PG_FUNCTION_ARGS)
int prettyFlags;
char *res;
prettyFlags = pretty ? PRETTYFLAG_PAREN | PRETTYFLAG_INDENT : PRETTYFLAG_INDENT;
prettyFlags = pretty ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) : PRETTYFLAG_INDENT;
res = pg_get_ruledef_worker(ruleoid, prettyFlags);
......@@ -620,7 +622,7 @@ pg_get_viewdef_ext(PG_FUNCTION_ARGS)
int prettyFlags;
char *res;
prettyFlags = pretty ? PRETTYFLAG_PAREN | PRETTYFLAG_INDENT : PRETTYFLAG_INDENT;
prettyFlags = pretty ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) : PRETTYFLAG_INDENT;
res = pg_get_viewdef_worker(viewoid, prettyFlags, WRAP_COLUMN_DEFAULT);
......@@ -640,7 +642,7 @@ pg_get_viewdef_wrap(PG_FUNCTION_ARGS)
char *res;
/* calling this implies we want pretty printing */
prettyFlags = PRETTYFLAG_PAREN | PRETTYFLAG_INDENT;
prettyFlags = PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA;
res = pg_get_viewdef_worker(viewoid, prettyFlags, wrap);
......@@ -686,7 +688,7 @@ pg_get_viewdef_name_ext(PG_FUNCTION_ARGS)
Oid viewoid;
char *res;
prettyFlags = pretty ? PRETTYFLAG_PAREN | PRETTYFLAG_INDENT : PRETTYFLAG_INDENT;
prettyFlags = pretty ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) : PRETTYFLAG_INDENT;
/* Look up view name. Can't lock it - we might not have privileges. */
viewrel = makeRangeVarFromNameList(textToQualifiedNameList(viewname));
......@@ -922,8 +924,15 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
appendStringInfoString(&buf, " TRUNCATE");
findx++;
}
/*
* In non-pretty mode, always schema-qualify the target table name for
* safety. In pretty mode, schema-qualify only if not visible.
*/
appendStringInfo(&buf, " ON %s ",
generate_relation_name(trigrec->tgrelid, NIL));
pretty ?
generate_relation_name(trigrec->tgrelid, NIL) :
generate_qualified_relation_name(trigrec->tgrelid));
if (OidIsValid(trigrec->tgconstraint))
{
......@@ -1017,7 +1026,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
context.windowClause = NIL;
context.windowTList = NIL;
context.varprefix = true;
context.prettyFlags = pretty ? PRETTYFLAG_PAREN | PRETTYFLAG_INDENT : PRETTYFLAG_INDENT;
context.prettyFlags = pretty ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) : PRETTYFLAG_INDENT;
context.wrapColumn = WRAP_COLUMN_DEFAULT;
context.indentLevel = PRETTYINDENT_STD;
context.special_exprkind = EXPR_KIND_NONE;
......@@ -1104,7 +1113,7 @@ pg_get_indexdef_ext(PG_FUNCTION_ARGS)
int prettyFlags;
char *res;
prettyFlags = pretty ? PRETTYFLAG_PAREN | PRETTYFLAG_INDENT : PRETTYFLAG_INDENT;
prettyFlags = pretty ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) : PRETTYFLAG_INDENT;
res = pg_get_indexdef_worker(indexrelid, colno, NULL, colno != 0, false,
false, prettyFlags, true);
......@@ -1132,7 +1141,8 @@ pg_get_indexdef_columns(Oid indexrelid, bool pretty)
{
int prettyFlags;
prettyFlags = pretty ? PRETTYFLAG_PAREN | PRETTYFLAG_INDENT : PRETTYFLAG_INDENT;
prettyFlags = pretty ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) : PRETTYFLAG_INDENT;
return pg_get_indexdef_worker(indexrelid, 0, NULL, true, false, false,
prettyFlags, false);
}
......@@ -1264,7 +1274,9 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
quote_identifier(NameStr(idxrelrec->relname)),
idxrelrec->relkind == RELKIND_PARTITIONED_INDEX
&& !inherits ? "ONLY " : "",
generate_relation_name(indrelid, NIL),
(prettyFlags & PRETTYFLAG_SCHEMA) ?
generate_relation_name(indrelid, NIL) :
generate_qualified_relation_name(indrelid),
quote_identifier(NameStr(amrec->amname)));
else /* currently, must be EXCLUDE constraint */
appendStringInfo(&buf, "EXCLUDE USING %s (",
......@@ -1575,7 +1587,8 @@ pg_get_partkeydef_columns(Oid relid, bool pretty)
{
int prettyFlags;
prettyFlags = pretty ? PRETTYFLAG_PAREN | PRETTYFLAG_INDENT : PRETTYFLAG_INDENT;
prettyFlags = pretty ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) : PRETTYFLAG_INDENT;
return pg_get_partkeydef_worker(relid, prettyFlags, true, false);
}
......@@ -1803,7 +1816,7 @@ pg_get_constraintdef_ext(PG_FUNCTION_ARGS)
int prettyFlags;
char *res;
prettyFlags = pretty ? PRETTYFLAG_PAREN | PRETTYFLAG_INDENT : PRETTYFLAG_INDENT;
prettyFlags = pretty ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) : PRETTYFLAG_INDENT;
res = pg_get_constraintdef_worker(constraintId, false, prettyFlags, true);
......@@ -2258,7 +2271,7 @@ pg_get_expr_ext(PG_FUNCTION_ARGS)
int prettyFlags;
char *relname;
prettyFlags = pretty ? PRETTYFLAG_PAREN | PRETTYFLAG_INDENT : PRETTYFLAG_INDENT;
prettyFlags = pretty ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) : PRETTYFLAG_INDENT;
if (OidIsValid(relid))
{
......@@ -4709,7 +4722,10 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
}
/* The relation the rule is fired on */
appendStringInfo(buf, " TO %s", generate_relation_name(ev_class, NIL));
appendStringInfo(buf, " TO %s",
(prettyFlags & PRETTYFLAG_SCHEMA) ?
generate_relation_name(ev_class, NIL) :
generate_qualified_relation_name(ev_class));
/* If the rule has an event qualification, add it */
if (ev_qual == NULL)
......
......@@ -32,6 +32,7 @@ static void AddAcl(PQExpBuffer aclbuf, const char *keyword,
*
* name: the object name, in the form to use in the commands (already quoted)
* subname: the sub-object name, if any (already quoted); NULL if none
* nspname: the namespace the object is in (NULL if none); not pre-quoted
* type: the object type (as seen in GRANT command: must be one of
* TABLE, SEQUENCE, FUNCTION, PROCEDURE, LANGUAGE, SCHEMA, DATABASE, TABLESPACE,
* FOREIGN DATA WRAPPER, SERVER, or LARGE OBJECT)
......@@ -52,7 +53,7 @@ static void AddAcl(PQExpBuffer aclbuf, const char *keyword,
* since this routine uses fmtId() internally.
*/
bool
buildACLCommands(const char *name, const char *subname,
buildACLCommands(const char *name, const char *subname, const char *nspname,
const char *type, const char *acls, const char *racls,
const char *owner, const char *prefix, int remoteVersion,
PQExpBuffer sql)
......@@ -152,7 +153,10 @@ buildACLCommands(const char *name, const char *subname,
appendPQExpBuffer(firstsql, "%sREVOKE ALL", prefix);
if (subname)
appendPQExpBuffer(firstsql, "(%s)", subname);
appendPQExpBuffer(firstsql, " ON %s %s FROM PUBLIC;\n", type, name);
appendPQExpBuffer(firstsql, " ON %s ", type);
if (nspname && *nspname)
appendPQExpBuffer(firstsql, "%s.", fmtId(nspname));
appendPQExpBuffer(firstsql, "%s FROM PUBLIC;\n", name);
}
else
{
......@@ -170,8 +174,11 @@ buildACLCommands(const char *name, const char *subname,
{
if (privs->len > 0)
{
appendPQExpBuffer(firstsql, "%sREVOKE %s ON %s %s FROM ",
prefix, privs->data, type, name);
appendPQExpBuffer(firstsql, "%sREVOKE %s ON %s ",
prefix, privs->data, type);
if (nspname && *nspname)
appendPQExpBuffer(firstsql, "%s.", fmtId(nspname));
appendPQExpBuffer(firstsql, "%s FROM ", name);
if (grantee->len == 0)
appendPQExpBufferStr(firstsql, "PUBLIC;\n");
else if (strncmp(grantee->data, "group ",
......@@ -185,8 +192,11 @@ buildACLCommands(const char *name, const char *subname,
if (privswgo->len > 0)
{
appendPQExpBuffer(firstsql,
"%sREVOKE GRANT OPTION FOR %s ON %s %s FROM ",
prefix, privswgo->data, type, name);
"%sREVOKE GRANT OPTION FOR %s ON %s ",
prefix, privswgo->data, type);
if (nspname && *nspname)
appendPQExpBuffer(firstsql, "%s.", fmtId(nspname));
appendPQExpBuffer(firstsql, "%s FROM ", name);
if (grantee->len == 0)
appendPQExpBufferStr(firstsql, "PUBLIC");
else if (strncmp(grantee->data, "group ",
......@@ -251,18 +261,33 @@ buildACLCommands(const char *name, const char *subname,
appendPQExpBuffer(firstsql, "%sREVOKE ALL", prefix);
if (subname)
appendPQExpBuffer(firstsql, "(%s)", subname);
appendPQExpBuffer(firstsql, " ON %s %s FROM %s;\n",
type, name, fmtId(grantee->data));
appendPQExpBuffer(firstsql, " ON %s ", type);
if (nspname && *nspname)
appendPQExpBuffer(firstsql, "%s.", fmtId(nspname));
appendPQExpBuffer(firstsql, "%s FROM %s;\n",
name, fmtId(grantee->data));
if (privs->len > 0)
{
appendPQExpBuffer(firstsql,
"%sGRANT %s ON %s %s TO %s;\n",
prefix, privs->data, type, name,
fmtId(grantee->data));
"%sGRANT %s ON %s ",
prefix, privs->data, type);
if (nspname && *nspname)
appendPQExpBuffer(firstsql, "%s.", fmtId(nspname));
appendPQExpBuffer(firstsql,
"%s TO %s;\n",
name, fmtId(grantee->data));
}
if (privswgo->len > 0)
{
appendPQExpBuffer(firstsql,
"%sGRANT %s ON %s %s TO %s WITH GRANT OPTION;\n",
prefix, privswgo->data, type, name,
fmtId(grantee->data));
"%sGRANT %s ON %s ",
prefix, privswgo->data, type);
if (nspname && *nspname)
appendPQExpBuffer(firstsql, "%s.", fmtId(nspname));
appendPQExpBuffer(firstsql,
"%s TO %s WITH GRANT OPTION;\n",
name, fmtId(grantee->data));
}
}
}
else
......@@ -284,8 +309,11 @@ buildACLCommands(const char *name, const char *subname,
if (privs->len > 0)
{
appendPQExpBuffer(secondsql, "%sGRANT %s ON %s %s TO ",
prefix, privs->data, type, name);
appendPQExpBuffer(secondsql, "%sGRANT %s ON %s ",
prefix, privs->data, type);
if (nspname && *nspname)
appendPQExpBuffer(secondsql, "%s.", fmtId(nspname));
appendPQExpBuffer(secondsql, "%s TO ", name);
if (grantee->len == 0)
appendPQExpBufferStr(secondsql, "PUBLIC;\n");
else if (strncmp(grantee->data, "group ",
......@@ -297,8 +325,11 @@ buildACLCommands(const char *name, const char *subname,
}
if (privswgo->len > 0)
{
appendPQExpBuffer(secondsql, "%sGRANT %s ON %s %s TO ",
prefix, privswgo->data, type, name);
appendPQExpBuffer(secondsql, "%sGRANT %s ON %s ",
prefix, privswgo->data, type);
if (nspname && *nspname)
appendPQExpBuffer(secondsql, "%s.", fmtId(nspname));
appendPQExpBuffer(secondsql, "%s TO ", name);
if (grantee->len == 0)
appendPQExpBufferStr(secondsql, "PUBLIC");
else if (strncmp(grantee->data, "group ",
......@@ -328,8 +359,11 @@ buildACLCommands(const char *name, const char *subname,
appendPQExpBuffer(firstsql, "%sREVOKE ALL", prefix);
if (subname)
appendPQExpBuffer(firstsql, "(%s)", subname);
appendPQExpBuffer(firstsql, " ON %s %s FROM %s;\n",
type, name, fmtId(owner));
appendPQExpBuffer(firstsql, " ON %s ", type);
if (nspname && *nspname)
appendPQExpBuffer(firstsql, "%s.", fmtId(nspname));
appendPQExpBuffer(firstsql, "%s FROM %s;\n",
name, fmtId(owner));
}
destroyPQExpBuffer(grantee);
......@@ -388,7 +422,8 @@ buildDefaultACLCommands(const char *type, const char *nspname,
if (strlen(initacls) != 0 || strlen(initracls) != 0)
{
appendPQExpBuffer(sql, "SELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\n");
if (!buildACLCommands("", NULL, type, initacls, initracls, owner,
if (!buildACLCommands("", NULL, NULL, type,
initacls, initracls, owner,
prefix->data, remoteVersion, sql))
{
destroyPQExpBuffer(prefix);
......@@ -397,7 +432,8 @@ buildDefaultACLCommands(const char *type, const char *nspname,
appendPQExpBuffer(sql, "SELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\n");
}
if (!buildACLCommands("", NULL, type, acls, racls, owner,
if (!buildACLCommands("", NULL, NULL, type,
acls, racls, owner,
prefix->data, remoteVersion, sql))
{
destroyPQExpBuffer(prefix);
......@@ -641,26 +677,32 @@ AddAcl(PQExpBuffer aclbuf, const char *keyword, const char *subname)
* buildShSecLabelQuery
*
* Build a query to retrieve security labels for a shared object.
* The object is identified by its OID plus the name of the catalog
* it can be found in (e.g., "pg_database" for database names).
* The query is appended to "sql". (We don't execute it here so as to
* keep this file free of assumptions about how to deal with SQL errors.)
*/
void
buildShSecLabelQuery(PGconn *conn, const char *catalog_name, uint32 objectId,
buildShSecLabelQuery(PGconn *conn, const char *catalog_name, Oid objectId,
PQExpBuffer sql)
{
appendPQExpBuffer(sql,
"SELECT provider, label FROM pg_catalog.pg_shseclabel "
"WHERE classoid = '%s'::pg_catalog.regclass AND "
"objoid = %u", catalog_name, objectId);
"WHERE classoid = 'pg_catalog.%s'::pg_catalog.regclass "
"AND objoid = '%u'", catalog_name, objectId);
}
/*
* emitShSecLabels
*
* Format security label data retrieved by the query generated in
* buildShSecLabelQuery.
* Construct SECURITY LABEL commands using the data retrieved by the query
* generated by buildShSecLabelQuery, and append them to "buffer".
* Here, the target object is identified by its type name (e.g. "DATABASE")
* and its name (not pre-quoted).
*/
void
emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer,
const char *target, const char *objname)
const char *objtype, const char *objname)
{
int i;
......@@ -672,7 +714,7 @@ emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer,
/* must use fmtId result before calling it again */
appendPQExpBuffer(buffer,
"SECURITY LABEL FOR %s ON %s",
fmtId(provider), target);
fmtId(provider), objtype);
appendPQExpBuffer(buffer,
" %s IS ",
fmtId(objname));
......
......@@ -36,7 +36,7 @@
#endif
extern bool buildACLCommands(const char *name, const char *subname,
extern bool buildACLCommands(const char *name, const char *subname, const char *nspname,
const char *type, const char *acls, const char *racls,
const char *owner, const char *prefix, int remoteVersion,
PQExpBuffer sql);
......@@ -47,9 +47,9 @@ extern bool buildDefaultACLCommands(const char *type, const char *nspname,
int remoteVersion,
PQExpBuffer sql);
extern void buildShSecLabelQuery(PGconn *conn, const char *catalog_name,
uint32 objectId, PQExpBuffer sql);
Oid objectId, PQExpBuffer sql);
extern void emitShSecLabels(PGconn *conn, PGresult *res,
PQExpBuffer buffer, const char *target, const char *objname);
PQExpBuffer buffer, const char *objtype, const char *objname);
extern void buildACLQueries(PQExpBuffer acl_subquery, PQExpBuffer racl_subquery,
PQExpBuffer init_acl_subquery, PQExpBuffer init_racl_subquery,
......
......@@ -197,6 +197,9 @@ typedef struct Archive
/* info needed for string escaping */
int encoding; /* libpq code for client_encoding */
bool std_strings; /* standard_conforming_strings */
/* other important stuff */
char *searchpath; /* search_path to set during restore */
char *use_role; /* Issue SET ROLE to this */
/* error handling */
......
......@@ -70,6 +70,7 @@ static void _selectOutputSchema(ArchiveHandle *AH, const char *schemaName);
static void _selectTablespace(ArchiveHandle *AH, const char *tablespace);
static void processEncodingEntry(ArchiveHandle *AH, TocEntry *te);
static void processStdStringsEntry(ArchiveHandle *AH, TocEntry *te);
static void processSearchPathEntry(ArchiveHandle *AH, TocEntry *te);
static teReqs _tocEntryRequired(TocEntry *te, teSection curSection, ArchiveHandle *AH);
static RestorePass _tocEntryRestorePass(TocEntry *te);
static bool _tocEntryIsACL(TocEntry *te);
......@@ -900,7 +901,9 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool is_parallel)
ahprintf(AH, "TRUNCATE TABLE %s%s;\n\n",
(PQserverVersion(AH->connection) >= 80400 ?
"ONLY " : ""),
fmtId(te->tag));
fmtQualifiedId(PQserverVersion(AH->connection),
te->namespace,
te->tag));
}
/*
......@@ -987,10 +990,10 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te)
/*
* Disable them.
*/
_selectOutputSchema(AH, te->namespace);
ahprintf(AH, "ALTER TABLE %s DISABLE TRIGGER ALL;\n\n",
fmtId(te->tag));
fmtQualifiedId(PQserverVersion(AH->connection),
te->namespace,
te->tag));
}
static void
......@@ -1015,10 +1018,10 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te)
/*
* Enable them.
*/
_selectOutputSchema(AH, te->namespace);
ahprintf(AH, "ALTER TABLE %s ENABLE TRIGGER ALL;\n\n",
fmtId(te->tag));
fmtQualifiedId(PQserverVersion(AH->connection),
te->namespace,
te->tag));
}
/*
......@@ -2711,6 +2714,8 @@ ReadToc(ArchiveHandle *AH)
processEncodingEntry(AH, te);
else if (strcmp(te->desc, "STDSTRINGS") == 0)
processStdStringsEntry(AH, te);
else if (strcmp(te->desc, "SEARCHPATH") == 0)
processSearchPathEntry(AH, te);
}
}
......@@ -2758,6 +2763,16 @@ processStdStringsEntry(ArchiveHandle *AH, TocEntry *te)
te->defn);
}
static void
processSearchPathEntry(ArchiveHandle *AH, TocEntry *te)
{
/*
* te->defn should contain a command to set search_path. We just copy it
* verbatim for use later.
*/
AH->public.searchpath = pg_strdup(te->defn);
}
static void
StrictNamesCheck(RestoreOptions *ropt)
{
......@@ -2814,9 +2829,10 @@ _tocEntryRequired(TocEntry *te, teSection curSection, ArchiveHandle *AH)
teReqs res = REQ_SCHEMA | REQ_DATA;
RestoreOptions *ropt = AH->public.ropt;
/* ENCODING and STDSTRINGS items are treated specially */
/* These items are treated specially */
if (strcmp(te->desc, "ENCODING") == 0 ||
strcmp(te->desc, "STDSTRINGS") == 0)
strcmp(te->desc, "STDSTRINGS") == 0 ||
strcmp(te->desc, "SEARCHPATH") == 0)
return REQ_SPECIAL;
/*
......@@ -3117,6 +3133,10 @@ _doSetFixedOutputState(ArchiveHandle *AH)
if (ropt && ropt->use_role)
ahprintf(AH, "SET ROLE %s;\n", fmtId(ropt->use_role));
/* Select the dump-time search_path */
if (AH->public.searchpath)
ahprintf(AH, "%s", AH->public.searchpath);
/* Make sure function checking is disabled */
ahprintf(AH, "SET check_function_bodies = false;\n");
......@@ -3321,6 +3341,15 @@ _selectOutputSchema(ArchiveHandle *AH, const char *schemaName)
{
PQExpBuffer qry;
/*
* If there was a SEARCHPATH TOC entry, we're supposed to just stay with
* that search_path rather than switching to entry-specific paths.
* Otherwise, it's an old archive that will not restore correctly unless
* we set the search_path as it's expecting.
*/
if (AH->public.searchpath)
return;
if (!schemaName || *schemaName == '\0' ||
(AH->currSchema && strcmp(AH->currSchema, schemaName) == 0))
return; /* no need to do anything */
......@@ -3453,8 +3482,10 @@ _getObjectDescription(PQExpBuffer buf, TocEntry *te, ArchiveHandle *AH)
strcmp(type, "SUBSCRIPTION") == 0 ||
strcmp(type, "USER MAPPING") == 0)
{
/* We already know that search_path was set properly */
appendPQExpBuffer(buf, "%s %s", type, fmtId(te->tag));
appendPQExpBuffer(buf, "%s ", type);
if (te->namespace && *te->namespace)
appendPQExpBuffer(buf, "%s.", fmtId(te->namespace));
appendPQExpBufferStr(buf, fmtId(te->tag));
return;
}
......
......@@ -92,10 +92,12 @@ typedef z_stream *z_streamp;
* indicator */
#define K_VERS_1_12 MAKE_ARCHIVE_VERSION(1, 12, 0) /* add separate BLOB
* entries */
#define K_VERS_1_13 MAKE_ARCHIVE_VERSION(1, 13, 0) /* change search_path
* behavior */
/* Current archive version number (the format we can output) */
#define K_VERS_MAJOR 1
#define K_VERS_MINOR 12
#define K_VERS_MINOR 13
#define K_VERS_REV 0
#define K_VERS_SELF MAKE_ARCHIVE_VERSION(K_VERS_MAJOR, K_VERS_MINOR, K_VERS_REV);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -42,9 +42,10 @@ static void dumpUserConfig(PGconn *conn, const char *username);
static void dumpDatabases(PGconn *conn);
static void dumpTimestamp(const char *msg);
static int runPgDump(const char *dbname, const char *create_opts);
static void buildShSecLabels(PGconn *conn, const char *catalog_name,
uint32 objectId, PQExpBuffer buffer,
const char *target, const char *objname);
static void buildShSecLabels(PGconn *conn,
const char *catalog_name, Oid objectId,
const char *objtype, const char *objname,
PQExpBuffer buffer);
static PGconn *connectDatabase(const char *dbname, const char *connstr, const char *pghost, const char *pgport,
const char *pguser, trivalue prompt_password, bool fail_on_error);
static char *constructConnStr(const char **keywords, const char **values);
......@@ -928,7 +929,8 @@ dumpRoles(PGconn *conn)
if (!no_security_labels && server_version >= 90200)
buildShSecLabels(conn, "pg_authid", auth_oid,
buf, "ROLE", rolename);
"ROLE", rolename,
buf);
fprintf(OPF, "%s", buf->data);
}
......@@ -1191,7 +1193,7 @@ dumpTablespaces(PGconn *conn)
for (i = 0; i < PQntuples(res); i++)
{
PQExpBuffer buf = createPQExpBuffer();
uint32 spcoid = atooid(PQgetvalue(res, i, 0));
Oid spcoid = atooid(PQgetvalue(res, i, 0));
char *spcname = PQgetvalue(res, i, 1);
char *spcowner = PQgetvalue(res, i, 2);
char *spclocation = PQgetvalue(res, i, 3);
......@@ -1216,11 +1218,12 @@ dumpTablespaces(PGconn *conn)
fspcname, spcoptions);
if (!skip_acls &&
!buildACLCommands(fspcname, NULL, "TABLESPACE", spcacl, rspcacl,
!buildACLCommands(fspcname, NULL, NULL, "TABLESPACE",
spcacl, rspcacl,
spcowner, "", server_version, buf))
{
fprintf(stderr, _("%s: could not parse ACL list (%s) for tablespace \"%s\"\n"),
progname, spcacl, fspcname);
progname, spcacl, spcname);
PQfinish(conn);
exit_nicely(1);
}
......@@ -1234,7 +1237,8 @@ dumpTablespaces(PGconn *conn)
if (!no_security_labels && server_version >= 90200)
buildShSecLabels(conn, "pg_tablespace", spcoid,
buf, "TABLESPACE", fspcname);
"TABLESPACE", spcname,
buf);
fprintf(OPF, "%s", buf->data);
......@@ -1481,19 +1485,23 @@ runPgDump(const char *dbname, const char *create_opts)
*
* Build SECURITY LABEL command(s) for a shared object
*
* The caller has to provide object type and identifier to select security
* labels from pg_seclabels system view.
* The caller has to provide object type and identity in two separate formats:
* catalog_name (e.g., "pg_database") and object OID, as well as
* type name (e.g., "DATABASE") and object name (not pre-quoted).
*
* The command(s) are appended to "buffer".
*/
static void
buildShSecLabels(PGconn *conn, const char *catalog_name, uint32 objectId,
PQExpBuffer buffer, const char *target, const char *objname)
buildShSecLabels(PGconn *conn, const char *catalog_name, Oid objectId,
const char *objtype, const char *objname,
PQExpBuffer buffer)
{
PQExpBuffer sql = createPQExpBuffer();
PGresult *res;
buildShSecLabelQuery(conn, catalog_name, objectId, sql);
res = executeQuery(conn, sql->data);
emitShSecLabels(conn, res, buffer, target, objname);
emitShSecLabels(conn, res, buffer, objtype, objname);
PQclear(res);
destroyPQExpBuffer(sql);
......
......@@ -460,7 +460,7 @@ my %tests = (
'ALTER COLLATION test0 OWNER TO' => {
all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except post-data objects)',
regexp => qr/^ALTER COLLATION test0 OWNER TO .*;/m,
regexp => qr/^ALTER COLLATION public.test0 OWNER TO .*;/m,
collation => 1,
like => {
binary_upgrade => 1,
......@@ -604,7 +604,7 @@ my %tests = (
FUNCTION 1 (int4, int4) btint4cmp(int4,int4),
FUNCTION 2 (int4, int4) btint4sortsupport(internal);',
regexp => qr/^
\QALTER OPERATOR FAMILY op_family USING btree ADD\E\n\s+
\QALTER OPERATOR FAMILY dump_test.op_family USING btree ADD\E\n\s+
\QOPERATOR 1 <(bigint,integer) ,\E\n\s+
\QOPERATOR 2 <=(bigint,integer) ,\E\n\s+
\QOPERATOR 3 =(bigint,integer) ,\E\n\s+
......@@ -809,7 +809,7 @@ my %tests = (
'ALTER SEQUENCE test_table_col1_seq' => {
all_runs => 1,
regexp => qr/^
\QALTER SEQUENCE test_table_col1_seq OWNED BY test_table.col1;\E
\QALTER SEQUENCE dump_test.test_table_col1_seq OWNED BY dump_test.test_table.col1;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -842,7 +842,7 @@ my %tests = (
'ALTER SEQUENCE test_third_table_col1_seq' => {
all_runs => 1,
regexp => qr/^
\QALTER SEQUENCE test_third_table_col1_seq OWNED BY test_third_table.col1;\E
\QALTER SEQUENCE dump_test_second_schema.test_third_table_col1_seq OWNED BY dump_test_second_schema.test_third_table.col1;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -876,7 +876,7 @@ my %tests = (
all_runs => 1,
catch_all => 'ALTER TABLE ... commands',
regexp => qr/^
\QALTER TABLE ONLY test_table\E \n^\s+
\QALTER TABLE ONLY dump_test.test_table\E \n^\s+
\QADD CONSTRAINT test_table_pkey PRIMARY KEY (col1);\E
/xm,
like => {
......@@ -911,7 +911,7 @@ my %tests = (
create_sql =>
'ALTER TABLE dump_test.test_table ALTER COLUMN col1 SET STATISTICS 90;',
regexp => qr/^
\QALTER TABLE ONLY test_table ALTER COLUMN col1 SET STATISTICS 90;\E\n
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col1 SET STATISTICS 90;\E\n
/xm,
like => {
binary_upgrade => 1,
......@@ -945,7 +945,7 @@ my %tests = (
create_sql =>
'ALTER TABLE dump_test.test_table ALTER COLUMN col2 SET STORAGE EXTERNAL;',
regexp => qr/^
\QALTER TABLE ONLY test_table ALTER COLUMN col2 SET STORAGE EXTERNAL;\E\n
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col2 SET STORAGE EXTERNAL;\E\n
/xm,
like => {
binary_upgrade => 1,
......@@ -979,7 +979,7 @@ my %tests = (
create_sql =>
'ALTER TABLE dump_test.test_table ALTER COLUMN col3 SET STORAGE MAIN;',
regexp => qr/^
\QALTER TABLE ONLY test_table ALTER COLUMN col3 SET STORAGE MAIN;\E\n
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col3 SET STORAGE MAIN;\E\n
/xm,
like => {
binary_upgrade => 1,
......@@ -1013,7 +1013,7 @@ my %tests = (
create_sql =>
'ALTER TABLE dump_test.test_table ALTER COLUMN col4 SET (n_distinct = 10);',
regexp => qr/^
\QALTER TABLE ONLY test_table ALTER COLUMN col4 SET (n_distinct=10);\E\n
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col4 SET (n_distinct=10);\E\n
/xm,
like => {
binary_upgrade => 1,
......@@ -1044,7 +1044,7 @@ my %tests = (
=> {
all_runs => 1,
regexp => qr/^
\QALTER TABLE ONLY dump_test.measurement ATTACH PARTITION measurement_y2006m2 \E
\QALTER TABLE ONLY dump_test.measurement ATTACH PARTITION dump_test_second_schema.measurement_y2006m2 \E
\QFOR VALUES FROM ('2006-02-01') TO ('2006-03-01');\E\n
/xm,
like => { binary_upgrade => 1, },
......@@ -1081,7 +1081,7 @@ my %tests = (
create_sql =>
'ALTER TABLE dump_test.test_table CLUSTER ON test_table_pkey',
regexp => qr/^
\QALTER TABLE test_table CLUSTER ON test_table_pkey;\E\n
\QALTER TABLE dump_test.test_table CLUSTER ON test_table_pkey;\E\n
/xm,
like => {
binary_upgrade => 1,
......@@ -1112,10 +1112,10 @@ my %tests = (
all_runs => 1,
regexp => qr/^
\QSET SESSION AUTHORIZATION 'test_superuser';\E\n\n
\QALTER TABLE test_table DISABLE TRIGGER ALL;\E\n\n
\QCOPY test_table (col1, col2, col3, col4) FROM stdin;\E
\QALTER TABLE dump_test.test_table DISABLE TRIGGER ALL;\E\n\n
\QCOPY dump_test.test_table (col1, col2, col3, col4) FROM stdin;\E
\n(?:\d\t\\N\t\\N\t\\N\n){9}\\\.\n\n\n
\QALTER TABLE test_table ENABLE TRIGGER ALL;\E/xm,
\QALTER TABLE dump_test.test_table ENABLE TRIGGER ALL;\E/xm,
like => { data_only => 1, },
unlike => {
binary_upgrade => 1,
......@@ -1147,7 +1147,7 @@ my %tests = (
all_runs => 1,
catch_all => 'ALTER TABLE ... commands',
regexp => qr/^
\QALTER FOREIGN TABLE foreign_table ALTER COLUMN c1 OPTIONS (\E\n
\QALTER FOREIGN TABLE dump_test.foreign_table ALTER COLUMN c1 OPTIONS (\E\n
\s+\Qcolumn_name 'col1'\E\n
\Q);\E\n
/xm,
......@@ -1178,7 +1178,7 @@ my %tests = (
'ALTER TABLE test_table OWNER TO' => {
all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except post-data objects)',
regexp => qr/^ALTER TABLE test_table OWNER TO .*;/m,
regexp => qr/^ALTER TABLE dump_test.test_table OWNER TO .*;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1207,7 +1207,7 @@ my %tests = (
create_order => 23,
create_sql => 'ALTER TABLE dump_test.test_table
ENABLE ROW LEVEL SECURITY;',
regexp => qr/^ALTER TABLE test_table ENABLE ROW LEVEL SECURITY;/m,
regexp => qr/^ALTER TABLE dump_test.test_table ENABLE ROW LEVEL SECURITY;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1235,7 +1235,7 @@ my %tests = (
'ALTER TABLE test_second_table OWNER TO' => {
all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except post-data objects)',
regexp => qr/^ALTER TABLE test_second_table OWNER TO .*;/m,
regexp => qr/^ALTER TABLE dump_test.test_second_table OWNER TO .*;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1261,7 +1261,7 @@ my %tests = (
'ALTER TABLE test_third_table OWNER TO' => {
all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except post-data objects)',
regexp => qr/^ALTER TABLE test_third_table OWNER TO .*;/m,
regexp => qr/^ALTER TABLE dump_test_second_schema.test_third_table OWNER TO .*;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1287,7 +1287,7 @@ my %tests = (
'ALTER TABLE measurement OWNER TO' => {
all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except post-data objects)',
regexp => qr/^ALTER TABLE measurement OWNER TO .*;/m,
regexp => qr/^ALTER TABLE dump_test.measurement OWNER TO .*;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1313,7 +1313,7 @@ my %tests = (
'ALTER TABLE measurement_y2006m2 OWNER TO' => {
all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except post-data objects)',
regexp => qr/^ALTER TABLE measurement_y2006m2 OWNER TO .*;/m,
regexp => qr/^ALTER TABLE dump_test_second_schema.measurement_y2006m2 OWNER TO .*;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1339,7 +1339,7 @@ my %tests = (
'ALTER FOREIGN TABLE foreign_table OWNER TO' => {
all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except post-data objects)',
regexp => qr/^ALTER FOREIGN TABLE foreign_table OWNER TO .*;/m,
regexp => qr/^ALTER FOREIGN TABLE dump_test.foreign_table OWNER TO .*;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1366,7 +1366,7 @@ my %tests = (
all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except post-data objects)',
regexp =>
qr/^ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 OWNER TO .*;/m,
qr/^ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 OWNER TO .*;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1393,7 +1393,7 @@ my %tests = (
all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except post-data objects)',
regexp =>
qr/^ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 OWNER TO .*;/m,
qr/^ALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO .*;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1580,7 +1580,7 @@ qr/^ALTER (?!EVENT TRIGGER|LARGE OBJECT|STATISTICS|PUBLICATION|SUBSCRIPTION)(.*)
create_order => 36,
create_sql => 'COMMENT ON TABLE dump_test.test_table
IS \'comment on table\';',
regexp => qr/^COMMENT ON TABLE test_table IS 'comment on table';/m,
regexp => qr/^COMMENT ON TABLE dump_test.test_table IS 'comment on table';/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1613,7 +1613,7 @@ qr/^ALTER (?!EVENT TRIGGER|LARGE OBJECT|STATISTICS|PUBLICATION|SUBSCRIPTION)(.*)
create_sql => 'COMMENT ON COLUMN dump_test.test_table.col1
IS \'comment on column\';',
regexp => qr/^
\QCOMMENT ON COLUMN test_table.col1 IS 'comment on column';\E
\QCOMMENT ON COLUMN dump_test.test_table.col1 IS 'comment on column';\E
/xm,
like => {
binary_upgrade => 1,
......@@ -1647,7 +1647,7 @@ qr/^ALTER (?!EVENT TRIGGER|LARGE OBJECT|STATISTICS|PUBLICATION|SUBSCRIPTION)(.*)
create_sql => 'COMMENT ON COLUMN dump_test.composite.f1
IS \'comment on column of type\';',
regexp => qr/^
\QCOMMENT ON COLUMN composite.f1 IS 'comment on column of type';\E
\QCOMMENT ON COLUMN dump_test.composite.f1 IS 'comment on column of type';\E
/xm,
like => {
binary_upgrade => 1,
......@@ -1681,7 +1681,7 @@ qr/^ALTER (?!EVENT TRIGGER|LARGE OBJECT|STATISTICS|PUBLICATION|SUBSCRIPTION)(.*)
create_sql => 'COMMENT ON COLUMN dump_test.test_second_table.col1
IS \'comment on column col1\';',
regexp => qr/^
\QCOMMENT ON COLUMN test_second_table.col1 IS 'comment on column col1';\E
\QCOMMENT ON COLUMN dump_test.test_second_table.col1 IS 'comment on column col1';\E
/xm,
like => {
binary_upgrade => 1,
......@@ -1715,7 +1715,7 @@ qr/^ALTER (?!EVENT TRIGGER|LARGE OBJECT|STATISTICS|PUBLICATION|SUBSCRIPTION)(.*)
create_sql => 'COMMENT ON COLUMN dump_test.test_second_table.col2
IS \'comment on column col2\';',
regexp => qr/^
\QCOMMENT ON COLUMN test_second_table.col2 IS 'comment on column col2';\E
\QCOMMENT ON COLUMN dump_test.test_second_table.col2 IS 'comment on column col2';\E
/xm,
like => {
binary_upgrade => 1,
......@@ -1749,7 +1749,7 @@ qr/^ALTER (?!EVENT TRIGGER|LARGE OBJECT|STATISTICS|PUBLICATION|SUBSCRIPTION)(.*)
create_sql => 'COMMENT ON CONVERSION dump_test.test_conversion
IS \'comment on test conversion\';',
regexp =>
qr/^COMMENT ON CONVERSION test_conversion IS 'comment on test conversion';/m,
qr/^COMMENT ON CONVERSION dump_test.test_conversion IS 'comment on test conversion';/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1782,7 +1782,7 @@ qr/^COMMENT ON CONVERSION test_conversion IS 'comment on test conversion';/m,
create_sql => 'COMMENT ON COLLATION test0
IS \'comment on test0 collation\';',
regexp =>
qr/^COMMENT ON COLLATION test0 IS 'comment on test0 collation';/m,
qr/^COMMENT ON COLLATION public.test0 IS 'comment on test0 collation';/m,
collation => 1,
like => {
binary_upgrade => 1,
......@@ -1928,7 +1928,7 @@ qr/^COMMENT ON CONVERSION test_conversion IS 'comment on test conversion';/m,
'COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1
IS \'comment on text search configuration\';',
regexp =>
qr/^COMMENT ON TEXT SEARCH CONFIGURATION alt_ts_conf1 IS 'comment on text search configuration';/m,
qr/^COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 IS 'comment on text search configuration';/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1962,7 +1962,7 @@ qr/^COMMENT ON TEXT SEARCH CONFIGURATION alt_ts_conf1 IS 'comment on text search
'COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1
IS \'comment on text search dictionary\';',
regexp =>
qr/^COMMENT ON TEXT SEARCH DICTIONARY alt_ts_dict1 IS 'comment on text search dictionary';/m,
qr/^COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 IS 'comment on text search dictionary';/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -1995,7 +1995,7 @@ qr/^COMMENT ON TEXT SEARCH DICTIONARY alt_ts_dict1 IS 'comment on text search di
create_sql => 'COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1
IS \'comment on text search parser\';',
regexp =>
qr/^COMMENT ON TEXT SEARCH PARSER alt_ts_prs1 IS 'comment on text search parser';/m,
qr/^COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 IS 'comment on text search parser';/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -2028,7 +2028,7 @@ qr/^COMMENT ON TEXT SEARCH PARSER alt_ts_prs1 IS 'comment on text search parser'
create_sql => 'COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1
IS \'comment on text search template\';',
regexp =>
qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search template';/m,
qr/^COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text search template';/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -2060,7 +2060,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
create_order => 68,
create_sql => 'COMMENT ON TYPE dump_test.planets
IS \'comment on enum type\';',
regexp => qr/^COMMENT ON TYPE planets IS 'comment on enum type';/m,
regexp => qr/^COMMENT ON TYPE dump_test.planets IS 'comment on enum type';/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -2092,7 +2092,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
create_order => 69,
create_sql => 'COMMENT ON TYPE dump_test.textrange
IS \'comment on range type\';',
regexp => qr/^COMMENT ON TYPE textrange IS 'comment on range type';/m,
regexp => qr/^COMMENT ON TYPE dump_test.textrange IS 'comment on range type';/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -2124,7 +2124,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
create_order => 70,
create_sql => 'COMMENT ON TYPE dump_test.int42
IS \'comment on regular type\';',
regexp => qr/^COMMENT ON TYPE int42 IS 'comment on regular type';/m,
regexp => qr/^COMMENT ON TYPE dump_test.int42 IS 'comment on regular type';/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -2157,7 +2157,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
create_sql => 'COMMENT ON TYPE dump_test.undefined
IS \'comment on undefined type\';',
regexp =>
qr/^COMMENT ON TYPE undefined IS 'comment on undefined type';/m,
qr/^COMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -2200,7 +2200,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
create_sql => 'INSERT INTO dump_test.test_table (col1) '
. 'SELECT generate_series FROM generate_series(1,9);',
regexp => qr/^
\QCOPY test_table (col1, col2, col3, col4) FROM stdin;\E
\QCOPY dump_test.test_table (col1, col2, col3, col4) FROM stdin;\E
\n(?:\d\t\\N\t\\N\t\\N\n){9}\\\.\n
/xm,
like => {
......@@ -2231,7 +2231,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
create_sql => 'INSERT INTO dump_test.fk_reference_test_table (col1) '
. 'SELECT generate_series FROM generate_series(1,5);',
regexp => qr/^
\QCOPY fk_reference_test_table (col1) FROM stdin;\E
\QCOPY dump_test.fk_reference_test_table (col1) FROM stdin;\E
\n(?:\d\n){5}\\\.\n
/xm,
like => {
......@@ -2262,9 +2262,9 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
all_runs => 0, # really only for data-only
catch_all => 'COPY ... commands',
regexp => qr/^
\QCOPY test_table (col1, col2, col3, col4) FROM stdin;\E
\QCOPY dump_test.test_table (col1, col2, col3, col4) FROM stdin;\E
\n(?:\d\t\\N\t\\N\t\\N\n){9}\\\.\n.*
\QCOPY fk_reference_test_table (col1) FROM stdin;\E
\QCOPY dump_test.fk_reference_test_table (col1) FROM stdin;\E
\n(?:\d\n){5}\\\.\n
/xms,
like => { data_only => 1, },
......@@ -2278,7 +2278,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
. 'SELECT generate_series, generate_series::text '
. 'FROM generate_series(1,9);',
regexp => qr/^
\QCOPY test_second_table (col1, col2) FROM stdin;\E
\QCOPY dump_test.test_second_table (col1, col2) FROM stdin;\E
\n(?:\d\t\d\n){9}\\\.\n
/xm,
like => {
......@@ -2310,7 +2310,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
'INSERT INTO dump_test_second_schema.test_third_table (col1) '
. 'SELECT generate_series FROM generate_series(1,9);',
regexp => qr/^
\QCOPY test_third_table (col1) FROM stdin;\E
\QCOPY dump_test_second_schema.test_third_table (col1) FROM stdin;\E
\n(?:\d\n){9}\\\.\n
/xm,
like => {
......@@ -2338,7 +2338,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
all_runs => 1,
catch_all => 'COPY ... commands',
regexp => qr/^
\QCOPY test_third_table (col1) WITH OIDS FROM stdin;\E
\QCOPY dump_test_second_schema.test_third_table (col1) WITH OIDS FROM stdin;\E
\n(?:\d+\t\d\n){9}\\\.\n
/xm,
like => { with_oids => 1, },
......@@ -2368,7 +2368,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
create_sql =>
'INSERT INTO dump_test.test_fourth_table DEFAULT VALUES;',
regexp => qr/^
\QCOPY test_fourth_table FROM stdin;\E
\QCOPY dump_test.test_fourth_table FROM stdin;\E
\n\n\\\.\n
/xm,
like => {
......@@ -2399,7 +2399,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
create_sql =>
'INSERT INTO dump_test.test_fifth_table VALUES (NULL, true, false, \'11001\'::bit(5), \'NaN\');',
regexp => qr/^
\QCOPY test_fifth_table (col1, col2, col3, col4, col5) FROM stdin;\E
\QCOPY dump_test.test_fifth_table (col1, col2, col3, col4, col5) FROM stdin;\E
\n\\N\tt\tf\t11001\tNaN\n\\\.\n
/xm,
like => {
......@@ -2430,7 +2430,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
create_sql =>
'INSERT INTO dump_test.test_table_identity (col2) VALUES (\'test\');',
regexp => qr/^
\QCOPY test_table_identity (col1, col2) FROM stdin;\E
\QCOPY dump_test.test_table_identity (col1, col2) FROM stdin;\E
\n1\ttest\n\\\.\n
/xm,
like => {
......@@ -2471,7 +2471,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
all_runs => 1,
catch_all => 'INSERT INTO ...',
regexp => qr/^
(?:INSERT\ INTO\ test_table\ \(col1,\ col2,\ col3,\ col4\)\ VALUES\ \(\d,\ NULL,\ NULL,\ NULL\);\n){9}
(?:INSERT\ INTO\ dump_test.test_table\ \(col1,\ col2,\ col3,\ col4\)\ VALUES\ \(\d,\ NULL,\ NULL,\ NULL\);\n){9}
/xm,
like => { column_inserts => 1, },
unlike => {}, },
......@@ -2480,7 +2480,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
all_runs => 1,
catch_all => 'INSERT INTO ...',
regexp => qr/^
(?:INSERT\ INTO\ test_second_table\ \(col1,\ col2\)
(?:INSERT\ INTO\ dump_test.test_second_table\ \(col1,\ col2\)
\ VALUES\ \(\d,\ '\d'\);\n){9}/xm,
like => { column_inserts => 1, },
unlike => {}, },
......@@ -2489,7 +2489,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
all_runs => 1,
catch_all => 'INSERT INTO ...',
regexp => qr/^
(?:INSERT\ INTO\ test_third_table\ \(col1\)
(?:INSERT\ INTO\ dump_test_second_schema.test_third_table\ \(col1\)
\ VALUES\ \(\d\);\n){9}/xm,
like => { column_inserts => 1, },
unlike => {}, },
......@@ -2497,7 +2497,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
'INSERT INTO test_fourth_table' => {
all_runs => 1,
catch_all => 'INSERT INTO ...',
regexp => qr/^\QINSERT INTO test_fourth_table DEFAULT VALUES;\E/m,
regexp => qr/^\QINSERT INTO dump_test.test_fourth_table DEFAULT VALUES;\E/m,
like => { column_inserts => 1, },
unlike => {}, },
......@@ -2505,7 +2505,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE alt_ts_temp1 IS 'comment on text search temp
all_runs => 1,
catch_all => 'INSERT INTO ...',
regexp =>
qr/^\QINSERT INTO test_fifth_table (col1, col2, col3, col4, col5) VALUES (NULL, true, false, B'11001', 'NaN');\E/m,
qr/^\QINSERT INTO dump_test.test_fifth_table (col1, col2, col3, col4, col5) VALUES (NULL, true, false, B'11001', 'NaN');\E/m,
like => { column_inserts => 1, },
unlike => {}, },
......@@ -2513,7 +2513,7 @@ qr/^\QINSERT INTO test_fifth_table (col1, col2, col3, col4, col5) VALUES (NULL,
all_runs => 1,
catch_all => 'INSERT INTO ...',
regexp =>
qr/^\QINSERT INTO test_table_identity (col1, col2) OVERRIDING SYSTEM VALUE VALUES (1, 'test');\E/m,
qr/^\QINSERT INTO dump_test.test_table_identity (col1, col2) OVERRIDING SYSTEM VALUE VALUES (1, 'test');\E/m,
like => { column_inserts => 1, },
unlike => {}, },
......@@ -2621,7 +2621,7 @@ qr/^\QINSERT INTO test_table_identity (col1, col2) OVERRIDING SYSTEM VALUE VALUE
create_order => 76,
create_sql => 'CREATE COLLATION test0 FROM "C";',
regexp => qr/^
\QCREATE COLLATION test0 (provider = libc, locale = 'C');\E/xm,
\QCREATE COLLATION public.test0 (provider = libc, locale = 'C');\E/xm,
collation => 1,
like => {
binary_upgrade => 1,
......@@ -2793,7 +2793,7 @@ qr/CREATE CAST \(timestamp with time zone AS interval\) WITH FUNCTION pg_catalog
initcond1 = \'{0,0}\'
);',
regexp => qr/^
\QCREATE AGGREGATE newavg(integer) (\E
\QCREATE AGGREGATE dump_test.newavg(integer) (\E
\n\s+\QSFUNC = int4_avg_accum,\E
\n\s+\QSTYPE = bigint[],\E
\n\s+\QINITCOND = '{0,0}',\E
......@@ -2834,7 +2834,7 @@ qr/CREATE CAST \(timestamp with time zone AS interval\) WITH FUNCTION pg_catalog
create_sql =>
'CREATE DEFAULT CONVERSION dump_test.test_conversion FOR \'LATIN1\' TO \'UTF8\' FROM iso8859_1_to_utf8;',
regexp =>
qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;\E/xm,
qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;\E/xm,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -2872,7 +2872,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
CHECK(VALUE ~ \'^\d{5}$\' OR
VALUE ~ \'^\d{5}-\d{4}$\');',
regexp => qr/^
\QCREATE DOMAIN us_postal_code AS text COLLATE pg_catalog."C" DEFAULT '10014'::text\E\n\s+
\QCREATE DOMAIN dump_test.us_postal_code AS text COLLATE pg_catalog."C" DEFAULT '10014'::text\E\n\s+
\QCONSTRAINT us_postal_code_check CHECK \E
\Q(((VALUE ~ '^\d{5}\E
\$\Q'::text) OR (VALUE ~ '^\d{5}-\d{4}\E\$
......@@ -2913,7 +2913,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
RETURNS LANGUAGE_HANDLER AS \'$libdir/plpgsql\',
\'plpgsql_call_handler\' LANGUAGE C;',
regexp => qr/^
\QCREATE FUNCTION pltestlang_call_handler() \E
\QCREATE FUNCTION dump_test.pltestlang_call_handler() \E
\QRETURNS language_handler\E
\n\s+\QLANGUAGE c\E
\n\s+AS\ \'\$
......@@ -2954,7 +2954,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
RETURNS trigger LANGUAGE plpgsql
AS $$ BEGIN RETURN NULL; END;$$;',
regexp => qr/^
\QCREATE FUNCTION trigger_func() RETURNS trigger\E
\QCREATE FUNCTION dump_test.trigger_func() RETURNS trigger\E
\n\s+\QLANGUAGE plpgsql\E
\n\s+AS\ \$\$
\Q BEGIN RETURN NULL; END;\E
......@@ -2994,7 +2994,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
RETURNS event_trigger LANGUAGE plpgsql
AS $$ BEGIN RETURN; END;$$;',
regexp => qr/^
\QCREATE FUNCTION event_trigger_func() RETURNS event_trigger\E
\QCREATE FUNCTION dump_test.event_trigger_func() RETURNS event_trigger\E
\n\s+\QLANGUAGE plpgsql\E
\n\s+AS\ \$\$
\Q BEGIN RETURN; END;\E
......@@ -3033,7 +3033,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
create_sql =>
'CREATE OPERATOR FAMILY dump_test.op_family USING btree;',
regexp => qr/^
\QCREATE OPERATOR FAMILY op_family USING btree;\E
\QCREATE OPERATOR FAMILY dump_test.op_family USING btree;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -3077,8 +3077,8 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
FUNCTION 1 btint8cmp(bigint,bigint),
FUNCTION 2 btint8sortsupport(internal);',
regexp => qr/^
\QCREATE OPERATOR CLASS op_class\E\n\s+
\QFOR TYPE bigint USING btree FAMILY op_family AS\E\n\s+
\QCREATE OPERATOR CLASS dump_test.op_class\E\n\s+
\QFOR TYPE bigint USING btree FAMILY dump_test.op_family AS\E\n\s+
\QOPERATOR 1 <(bigint,bigint) ,\E\n\s+
\QOPERATOR 2 <=(bigint,bigint) ,\E\n\s+
\QOPERATOR 3 =(bigint,bigint) ,\E\n\s+
......@@ -3162,9 +3162,9 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
FOR EACH ROW WHEN (NEW.col1 > 10)
EXECUTE PROCEDURE dump_test.trigger_func();',
regexp => qr/^
\QCREATE TRIGGER test_trigger BEFORE INSERT ON test_table \E
\QCREATE TRIGGER test_trigger BEFORE INSERT ON dump_test.test_table \E
\QFOR EACH ROW WHEN ((new.col1 > 10)) \E
\QEXECUTE PROCEDURE trigger_func();\E
\QEXECUTE PROCEDURE dump_test.trigger_func();\E
/xm,
like => {
binary_upgrade => 1,
......@@ -3200,7 +3200,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
create_sql => 'CREATE TYPE dump_test.planets
AS ENUM ( \'venus\', \'earth\', \'mars\' );',
regexp => qr/^
\QCREATE TYPE planets AS ENUM (\E
\QCREATE TYPE dump_test.planets AS ENUM (\E
\n\s+'venus',
\n\s+'earth',
\n\s+'mars'
......@@ -3236,7 +3236,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
'CREATE TYPE dump_test.planets AS ENUM pg_upgrade' => {
all_runs => 1,
regexp => qr/^
\QCREATE TYPE planets AS ENUM (\E
\QCREATE TYPE dump_test.planets AS ENUM (\E
\n\);.*^
\QALTER TYPE dump_test.planets ADD VALUE 'venus';\E
\n.*^
......@@ -3278,7 +3278,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
create_sql => 'CREATE TYPE dump_test.textrange
AS RANGE (subtype=text, collation="C");',
regexp => qr/^
\QCREATE TYPE textrange AS RANGE (\E
\QCREATE TYPE dump_test.textrange AS RANGE (\E
\n\s+\Qsubtype = text,\E
\n\s+\Qcollation = pg_catalog."C"\E
\n\);/xm,
......@@ -3314,7 +3314,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
all_runs => 1,
create_order => 39,
create_sql => 'CREATE TYPE dump_test.int42;',
regexp => qr/^CREATE TYPE int42;/m,
regexp => qr/^CREATE TYPE dump_test.int42;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -3349,7 +3349,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
create_sql =>
'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 (copy=english);',
regexp => qr/^
\QCREATE TEXT SEARCH CONFIGURATION alt_ts_conf1 (\E\n
\QCREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 (\E\n
\s+\QPARSER = pg_catalog."default" );\E/xm,
like => {
binary_upgrade => 1,
......@@ -3382,61 +3382,61 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
'ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 ...' => {
all_runs => 1,
regexp => qr/^
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR asciiword WITH english_stem;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR word WITH english_stem;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR numword WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR email WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR url WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR host WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR sfloat WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR version WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR hword_numpart WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR hword_part WITH english_stem;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR hword_asciipart WITH english_stem;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR numhword WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR asciihword WITH english_stem;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR hword WITH english_stem;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR url_path WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR file WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR "float" WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR "int" WITH simple;\E\n
\n
\QALTER TEXT SEARCH CONFIGURATION alt_ts_conf1\E\n
\QALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1\E\n
\s+\QADD MAPPING FOR uint WITH simple;\E\n
\n
/xm,
......@@ -3474,7 +3474,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
create_sql =>
'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 (lexize=dsimple_lexize);',
regexp => qr/^
\QCREATE TEXT SEARCH TEMPLATE alt_ts_temp1 (\E\n
\QCREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 (\E\n
\s+\QLEXIZE = dsimple_lexize );\E/xm,
like => {
binary_upgrade => 1,
......@@ -3510,7 +3510,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
create_sql => 'CREATE TEXT SEARCH PARSER dump_test.alt_ts_prs1
(start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);',
regexp => qr/^
\QCREATE TEXT SEARCH PARSER alt_ts_prs1 (\E\n
\QCREATE TEXT SEARCH PARSER dump_test.alt_ts_prs1 (\E\n
\s+\QSTART = prsd_start,\E\n
\s+\QGETTOKEN = prsd_nexttoken,\E\n
\s+\QEND = prsd_end,\E\n
......@@ -3550,7 +3550,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
create_sql =>
'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 (template=simple);',
regexp => qr/^
\QCREATE TEXT SEARCH DICTIONARY alt_ts_dict1 (\E\n
\QCREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 (\E\n
\s+\QTEMPLATE = pg_catalog.simple );\E\n
/xm,
like => {
......@@ -3588,7 +3588,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
RETURNS dump_test.int42 AS \'int4in\'
LANGUAGE internal STRICT IMMUTABLE;',
regexp => qr/^
\QCREATE FUNCTION int42_in(cstring) RETURNS int42\E
\QCREATE FUNCTION dump_test.int42_in(cstring) RETURNS dump_test.int42\E
\n\s+\QLANGUAGE internal IMMUTABLE STRICT\E
\n\s+AS\ \$\$int4in\$\$;
/xm,
......@@ -3627,7 +3627,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
RETURNS cstring AS \'int4out\'
LANGUAGE internal STRICT IMMUTABLE;',
regexp => qr/^
\QCREATE FUNCTION int42_out(int42) RETURNS cstring\E
\QCREATE FUNCTION dump_test.int42_out(dump_test.int42) RETURNS cstring\E
\n\s+\QLANGUAGE internal IMMUTABLE STRICT\E
\n\s+AS\ \$\$int4out\$\$;
/xm,
......@@ -3665,7 +3665,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
create_sql => 'CREATE PROCEDURE dump_test.ptest1(a int)
LANGUAGE SQL AS $$ INSERT INTO dump_test.test_table (col1) VALUES (a) $$;',
regexp => qr/^
\QCREATE PROCEDURE ptest1(a integer)\E
\QCREATE PROCEDURE dump_test.ptest1(a integer)\E
\n\s+\QLANGUAGE sql\E
\n\s+AS\ \$\$\Q INSERT INTO dump_test.test_table (col1) VALUES (a) \E\$\$;
/xm,
......@@ -3708,10 +3708,10 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
default = 42,
passedbyvalue);',
regexp => qr/^
\QCREATE TYPE int42 (\E
\QCREATE TYPE dump_test.int42 (\E
\n\s+\QINTERNALLENGTH = 4,\E
\n\s+\QINPUT = int42_in,\E
\n\s+\QOUTPUT = int42_out,\E
\n\s+\QINPUT = dump_test.int42_in,\E
\n\s+\QOUTPUT = dump_test.int42_out,\E
\n\s+\QDEFAULT = '42',\E
\n\s+\QALIGNMENT = int4,\E
\n\s+\QSTORAGE = plain,\E
......@@ -3753,9 +3753,9 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
f2 dump_test.int42
);',
regexp => qr/^
\QCREATE TYPE composite AS (\E
\QCREATE TYPE dump_test.composite AS (\E
\n\s+\Qf1 integer,\E
\n\s+\Qf2 int42\E
\n\s+\Qf2 dump_test.int42\E
\n\);
/xm,
like => {
......@@ -3790,7 +3790,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
all_runs => 1,
create_order => 39,
create_sql => 'CREATE TYPE dump_test.undefined;',
regexp => qr/^CREATE TYPE undefined;/m,
regexp => qr/^CREATE TYPE dump_test.undefined;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -3892,7 +3892,7 @@ qr/^\QCREATE DEFAULT CONVERSION test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8
'CREATE FOREIGN TABLE dump_test.foreign_table (c1 int options (column_name \'col1\'))
SERVER s1 OPTIONS (schema_name \'x1\');',
regexp => qr/
\QCREATE FOREIGN TABLE foreign_table (\E\n
\QCREATE FOREIGN TABLE dump_test.foreign_table (\E\n
\s+\Qc1 integer\E\n
\Q)\E\n
\QSERVER s1\E\n
......@@ -4006,7 +4006,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
HANDLER dump_test.pltestlang_call_handler;',
regexp => qr/^
\QCREATE PROCEDURAL LANGUAGE pltestlang \E
\QHANDLER pltestlang_call_handler;\E
\QHANDLER dump_test.pltestlang_call_handler;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -4040,9 +4040,9 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql => 'CREATE MATERIALIZED VIEW dump_test.matview (col1) AS
SELECT col1 FROM dump_test.test_table;',
regexp => qr/^
\QCREATE MATERIALIZED VIEW matview AS\E
\QCREATE MATERIALIZED VIEW dump_test.matview AS\E
\n\s+\QSELECT test_table.col1\E
\n\s+\QFROM test_table\E
\n\s+\QFROM dump_test.test_table\E
\n\s+\QWITH NO DATA;\E
/xm,
like => {
......@@ -4078,9 +4078,9 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
dump_test.matview_second (col1) AS
SELECT * FROM dump_test.matview;',
regexp => qr/^
\QCREATE MATERIALIZED VIEW matview_second AS\E
\QCREATE MATERIALIZED VIEW dump_test.matview_second AS\E
\n\s+\QSELECT matview.col1\E
\n\s+\QFROM matview\E
\n\s+\QFROM dump_test.matview\E
\n\s+\QWITH NO DATA;\E
/xm,
like => {
......@@ -4116,9 +4116,9 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
dump_test.matview_third (col1) AS
SELECT * FROM dump_test.matview_second WITH NO DATA;',
regexp => qr/^
\QCREATE MATERIALIZED VIEW matview_third AS\E
\QCREATE MATERIALIZED VIEW dump_test.matview_third AS\E
\n\s+\QSELECT matview_second.col1\E
\n\s+\QFROM matview_second\E
\n\s+\QFROM dump_test.matview_second\E
\n\s+\QWITH NO DATA;\E
/xm,
like => {
......@@ -4154,9 +4154,9 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
dump_test.matview_fourth (col1) AS
SELECT * FROM dump_test.matview_third WITH NO DATA;',
regexp => qr/^
\QCREATE MATERIALIZED VIEW matview_fourth AS\E
\QCREATE MATERIALIZED VIEW dump_test.matview_fourth AS\E
\n\s+\QSELECT matview_third.col1\E
\n\s+\QFROM matview_third\E
\n\s+\QFROM dump_test.matview_third\E
\n\s+\QWITH NO DATA;\E
/xm,
like => {
......@@ -4192,7 +4192,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
USING (true)
WITH CHECK (true);',
regexp => qr/^
\QCREATE POLICY p1 ON test_table \E
\QCREATE POLICY p1 ON dump_test.test_table \E
\QUSING (true) WITH CHECK (true);\E
/xm,
like => {
......@@ -4227,7 +4227,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql => 'CREATE POLICY p2 ON dump_test.test_table
FOR SELECT TO regress_dump_test_role USING (true);',
regexp => qr/^
\QCREATE POLICY p2 ON test_table FOR SELECT TO regress_dump_test_role \E
\QCREATE POLICY p2 ON dump_test.test_table FOR SELECT TO regress_dump_test_role \E
\QUSING (true);\E
/xm,
like => {
......@@ -4262,7 +4262,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql => 'CREATE POLICY p3 ON dump_test.test_table
FOR INSERT TO regress_dump_test_role WITH CHECK (true);',
regexp => qr/^
\QCREATE POLICY p3 ON test_table FOR INSERT \E
\QCREATE POLICY p3 ON dump_test.test_table FOR INSERT \E
\QTO regress_dump_test_role WITH CHECK (true);\E
/xm,
like => {
......@@ -4297,7 +4297,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql => 'CREATE POLICY p4 ON dump_test.test_table FOR UPDATE
TO regress_dump_test_role USING (true) WITH CHECK (true);',
regexp => qr/^
\QCREATE POLICY p4 ON test_table FOR UPDATE TO regress_dump_test_role \E
\QCREATE POLICY p4 ON dump_test.test_table FOR UPDATE TO regress_dump_test_role \E
\QUSING (true) WITH CHECK (true);\E
/xm,
like => {
......@@ -4332,7 +4332,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql => 'CREATE POLICY p5 ON dump_test.test_table
FOR DELETE TO regress_dump_test_role USING (true);',
regexp => qr/^
\QCREATE POLICY p5 ON test_table FOR DELETE \E
\QCREATE POLICY p5 ON dump_test.test_table FOR DELETE \E
\QTO regress_dump_test_role USING (true);\E
/xm,
like => {
......@@ -4367,7 +4367,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql => 'CREATE POLICY p6 ON dump_test.test_table AS RESTRICTIVE
USING (false);',
regexp => qr/^
\QCREATE POLICY p6 ON test_table AS RESTRICTIVE \E
\QCREATE POLICY p6 ON dump_test.test_table AS RESTRICTIVE \E
\QUSING (false);\E
/xm,
like => {
......@@ -4505,7 +4505,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql =>
'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_table;',
regexp => qr/^
\QALTER PUBLICATION pub1 ADD TABLE ONLY test_table;\E
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_table;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -4539,7 +4539,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql =>
'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_second_table;',
regexp => qr/^
\QALTER PUBLICATION pub1 ADD TABLE ONLY test_second_table;\E
\QALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_second_table;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -4667,7 +4667,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
CHECK (col1 <= 1000)
) WITH (autovacuum_enabled = false, fillfactor=80);',
regexp => qr/^
\QCREATE TABLE test_table (\E\n
\QCREATE TABLE dump_test.test_table (\E\n
\s+\Qcol1 integer NOT NULL,\E\n
\s+\Qcol2 text,\E\n
\s+\Qcol3 text,\E\n
......@@ -4708,7 +4708,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
col1 int primary key references dump_test.test_table
);',
regexp => qr/^
\QCREATE TABLE fk_reference_test_table (\E
\QCREATE TABLE dump_test.fk_reference_test_table (\E
\n\s+\Qcol1 integer NOT NULL\E
\n\);
/xm,
......@@ -4746,7 +4746,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
col2 text
);',
regexp => qr/^
\QCREATE TABLE test_second_table (\E
\QCREATE TABLE dump_test.test_second_table (\E
\n\s+\Qcol1 integer,\E
\n\s+\Qcol2 text\E
\n\);
......@@ -4790,7 +4790,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
(\Q-- TOC entry \E[0-9]+\ \(class\ 1259\ OID\ [0-9]+\)\n)?
\Q-- Name: test_third_table;\E.*\n
\Q--\E\n\n
\QCREATE UNLOGGED TABLE test_third_table (\E
\QCREATE UNLOGGED TABLE dump_test_second_schema.test_third_table (\E
\n\s+\Qcol1 integer NOT NULL\E
\n\);\n
/xm,
......@@ -4832,7 +4832,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
regexp => qr/^
\Q-- Name: measurement;\E.*\n
\Q--\E\n\n
\QCREATE TABLE measurement (\E\n
\QCREATE TABLE dump_test.measurement (\E\n
\s+\Qcity_id integer NOT NULL,\E\n
\s+\Qlogdate date NOT NULL,\E\n
\s+\Qpeaktemp integer,\E\n
......@@ -4876,7 +4876,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
regexp => qr/^
\Q-- Name: measurement_y2006m2;\E.*\n
\Q--\E\n\n
\QCREATE TABLE measurement_y2006m2 PARTITION OF dump_test.measurement\E\n
\QCREATE TABLE dump_test_second_schema.measurement_y2006m2 PARTITION OF dump_test.measurement\E\n
\QFOR VALUES FROM ('2006-02-01') TO ('2006-03-01');\E\n
/xm,
like => {
......@@ -4911,7 +4911,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql => 'CREATE TABLE dump_test.test_fourth_table (
);',
regexp => qr/^
\QCREATE TABLE test_fourth_table (\E
\QCREATE TABLE dump_test.test_fourth_table (\E
\n\);
/xm,
like => {
......@@ -4951,7 +4951,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
col5 float8
);',
regexp => qr/^
\QCREATE TABLE test_fifth_table (\E
\QCREATE TABLE dump_test.test_fifth_table (\E
\n\s+\Qcol1 integer,\E
\n\s+\Qcol2 boolean,\E
\n\s+\Qcol3 boolean,\E
......@@ -4993,13 +4993,13 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
col2 text
);',
regexp => qr/^
\QCREATE TABLE test_table_identity (\E\n
\QCREATE TABLE dump_test.test_table_identity (\E\n
\s+\Qcol1 integer NOT NULL,\E\n
\s+\Qcol2 text\E\n
\);
.*
\QALTER TABLE test_table_identity ALTER COLUMN col1 ADD GENERATED ALWAYS AS IDENTITY (\E\n
\s+\QSEQUENCE NAME test_table_identity_col1_seq\E\n
\QALTER TABLE dump_test.test_table_identity ALTER COLUMN col1 ADD GENERATED ALWAYS AS IDENTITY (\E\n
\s+\QSEQUENCE NAME dump_test.test_table_identity_col1_seq\E\n
\s+\QSTART WITH 1\E\n
\s+\QINCREMENT BY 1\E\n
\s+\QNO MINVALUE\E\n
......@@ -5039,7 +5039,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql => 'CREATE STATISTICS dump_test.test_ext_stats_no_options
ON col1, col2 FROM dump_test.test_fifth_table',
regexp => qr/^
\QCREATE STATISTICS dump_test.test_ext_stats_no_options ON col1, col2 FROM test_fifth_table;\E
\QCREATE STATISTICS dump_test.test_ext_stats_no_options ON col1, col2 FROM dump_test.test_fifth_table;\E
/xms,
like => {
binary_upgrade => 1,
......@@ -5073,7 +5073,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql => 'CREATE STATISTICS dump_test.test_ext_stats_opts
(ndistinct) ON col1, col2 FROM dump_test.test_fifth_table',
regexp => qr/^
\QCREATE STATISTICS dump_test.test_ext_stats_opts (ndistinct) ON col1, col2 FROM test_fifth_table;\E
\QCREATE STATISTICS dump_test.test_ext_stats_opts (ndistinct) ON col1, col2 FROM dump_test.test_fifth_table;\E
/xms,
like => {
binary_upgrade => 1,
......@@ -5104,7 +5104,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
all_runs => 1,
catch_all => 'CREATE ... commands',
regexp => qr/^
\QCREATE SEQUENCE test_table_col1_seq\E
\QCREATE SEQUENCE dump_test.test_table_col1_seq\E
\n\s+\QAS integer\E
\n\s+\QSTART WITH 1\E
\n\s+\QINCREMENT BY 1\E
......@@ -5141,7 +5141,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
all_runs => 1,
catch_all => 'CREATE ... commands',
regexp => qr/^
\QCREATE SEQUENCE test_third_table_col1_seq\E
\QCREATE SEQUENCE dump_test_second_schema.test_third_table_col1_seq\E
\n\s+\QAS integer\E
\n\s+\QSTART WITH 1\E
\n\s+\QINCREMENT BY 1\E
......@@ -5182,7 +5182,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
ON dump_test_second_schema.test_third_table (col1);',
regexp => qr/^
\QCREATE UNIQUE INDEX test_third_table_idx \E
\QON test_third_table USING btree (col1);\E
\QON dump_test_second_schema.test_third_table USING btree (col1);\E
/xm,
like => {
binary_upgrade => 1,
......@@ -5215,7 +5215,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_order => 92,
create_sql => 'CREATE INDEX ON dump_test.measurement (city_id, logdate);',
regexp => qr/^
\QCREATE INDEX measurement_city_id_logdate_idx ON ONLY measurement USING\E
\QCREATE INDEX measurement_city_id_logdate_idx ON ONLY dump_test.measurement USING\E
/xm,
like => {
binary_upgrade => 1,
......@@ -5248,7 +5248,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_order => 93,
create_sql => 'ALTER TABLE dump_test.measurement ADD PRIMARY KEY (city_id, logdate);',
regexp => qr/^
\QALTER TABLE ONLY measurement\E \n^\s+
\QALTER TABLE ONLY dump_test.measurement\E \n^\s+
\QADD CONSTRAINT measurement_pkey PRIMARY KEY (city_id, logdate);\E
/xm,
like => {
......@@ -5280,7 +5280,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
all_runs => 1,
catch_all => 'CREATE ... commands',
regexp => qr/^
\QCREATE INDEX measurement_y2006m2_city_id_logdate_idx ON measurement_y2006m2 \E
\QCREATE INDEX measurement_y2006m2_city_id_logdate_idx ON dump_test_second_schema.measurement_y2006m2 \E
/xm,
like => {
binary_upgrade => 1,
......@@ -5377,9 +5377,9 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
WITH (check_option = \'local\', security_barrier = true) AS
SELECT col1 FROM dump_test.test_table;',
regexp => qr/^
\QCREATE VIEW test_view WITH (security_barrier='true') AS\E
\QCREATE VIEW dump_test.test_view WITH (security_barrier='true') AS\E
\n\s+\QSELECT test_table.col1\E
\n\s+\QFROM test_table\E
\n\s+\QFROM dump_test.test_table\E
\n\s+\QWITH LOCAL CHECK OPTION;\E/xm,
like => {
binary_upgrade => 1,
......@@ -5413,7 +5413,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql =>
'ALTER VIEW dump_test.test_view ALTER COLUMN col1 SET DEFAULT 1;',
regexp => qr/^
\QALTER TABLE ONLY test_view ALTER COLUMN col1 SET DEFAULT 1;\E/xm,
\QALTER TABLE ONLY dump_test.test_view ALTER COLUMN col1 SET DEFAULT 1;\E/xm,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -5799,7 +5799,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql =>
'GRANT USAGE ON DOMAIN dump_test.us_postal_code TO regress_dump_test_role;',
regexp => qr/^
\QGRANT ALL ON TYPE us_postal_code TO regress_dump_test_role;\E
\QGRANT ALL ON TYPE dump_test.us_postal_code TO regress_dump_test_role;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -5836,7 +5836,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql =>
'GRANT USAGE ON TYPE dump_test.int42 TO regress_dump_test_role;',
regexp => qr/^
\QGRANT ALL ON TYPE int42 TO regress_dump_test_role;\E
\QGRANT ALL ON TYPE dump_test.int42 TO regress_dump_test_role;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -5873,7 +5873,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql =>
'GRANT USAGE ON TYPE dump_test.planets TO regress_dump_test_role;',
regexp => qr/^
\QGRANT ALL ON TYPE planets TO regress_dump_test_role;\E
\QGRANT ALL ON TYPE dump_test.planets TO regress_dump_test_role;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -5910,7 +5910,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql =>
'GRANT USAGE ON TYPE dump_test.textrange TO regress_dump_test_role;',
regexp => qr/^
\QGRANT ALL ON TYPE textrange TO regress_dump_test_role;\E
\QGRANT ALL ON TYPE dump_test.textrange TO regress_dump_test_role;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -5979,7 +5979,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
create_sql => 'GRANT SELECT ON TABLE dump_test.test_table
TO regress_dump_test_role;',
regexp =>
qr/^GRANT SELECT ON TABLE test_table TO regress_dump_test_role;/m,
qr/^GRANT SELECT ON TABLE dump_test.test_table TO regress_dump_test_role;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -6012,7 +6012,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
TABLE dump_test_second_schema.test_third_table
TO regress_dump_test_role;',
regexp =>
qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
qr/^GRANT SELECT ON TABLE dump_test_second_schema.test_third_table TO regress_dump_test_role;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -6045,7 +6045,7 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
dump_test_second_schema.test_third_table_col1_seq
TO regress_dump_test_role;',
regexp => qr/^
\QGRANT ALL ON SEQUENCE test_third_table_col1_seq TO regress_dump_test_role;\E
\QGRANT ALL ON SEQUENCE dump_test_second_schema.test_third_table_col1_seq TO regress_dump_test_role;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -6079,7 +6079,7 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
TABLE dump_test.measurement
TO regress_dump_test_role;',
regexp =>
qr/^GRANT SELECT ON TABLE measurement TO regress_dump_test_role;/m,
qr/^GRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -6112,7 +6112,7 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
TABLE dump_test_second_schema.measurement_y2006m2
TO regress_dump_test_role;',
regexp =>
qr/^GRANT SELECT ON TABLE measurement_y2006m2 TO regress_dump_test_role;/m,
qr/^GRANT SELECT ON TABLE dump_test_second_schema.measurement_y2006m2 TO regress_dump_test_role;/m,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -6183,7 +6183,7 @@ qr/^GRANT SELECT ON TABLE measurement_y2006m2 TO regress_dump_test_role;/m,
'GRANT INSERT (col1) ON TABLE dump_test.test_second_table
TO regress_dump_test_role;',
regexp => qr/^
\QGRANT INSERT(col1) ON TABLE test_second_table TO regress_dump_test_role;\E
\QGRANT INSERT(col1) ON TABLE dump_test.test_second_table TO regress_dump_test_role;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -6216,7 +6216,7 @@ qr/^GRANT SELECT ON TABLE measurement_y2006m2 TO regress_dump_test_role;/m,
create_sql => 'GRANT EXECUTE ON FUNCTION pg_sleep(float8)
TO regress_dump_test_role;',
regexp => qr/^
\QGRANT ALL ON FUNCTION pg_sleep(double precision) TO regress_dump_test_role;\E
\QGRANT ALL ON FUNCTION pg_catalog.pg_sleep(double precision) TO regress_dump_test_role;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -6280,37 +6280,37 @@ qr/^GRANT SELECT ON TABLE measurement_y2006m2 TO regress_dump_test_role;/m,
proacl
) ON TABLE pg_proc TO public;',
regexp => qr/
\QGRANT SELECT(tableoid) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(oid) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proname) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(pronamespace) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proowner) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(prolang) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(procost) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(prorows) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(provariadic) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(protransform) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proisagg) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proiswindow) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(prosecdef) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proleakproof) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proisstrict) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proretset) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(provolatile) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proparallel) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(pronargs) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(pronargdefaults) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(prorettype) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proargtypes) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proallargtypes) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proargmodes) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proargnames) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proargdefaults) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(protrftypes) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(prosrc) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(probin) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proconfig) ON TABLE pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proacl) ON TABLE pg_proc TO PUBLIC;\E/xms,
\QGRANT SELECT(tableoid) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(oid) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proname) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(pronamespace) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proowner) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(prolang) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(procost) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(prorows) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(provariadic) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(protransform) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proisagg) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proiswindow) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(prosecdef) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proleakproof) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proisstrict) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proretset) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(provolatile) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proparallel) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(pronargs) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(pronargdefaults) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(prorettype) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proargtypes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proallargtypes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proargmodes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proargnames) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proargdefaults) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(protrftypes) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(prosrc) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(probin) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proconfig) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E\n.*
\QGRANT SELECT(proacl) ON TABLE pg_catalog.pg_proc TO PUBLIC;\E/xms,
like => {
binary_upgrade => 1,
clean => 1,
......@@ -6376,7 +6376,7 @@ qr/^GRANT SELECT ON TABLE measurement_y2006m2 TO regress_dump_test_role;/m,
'REFRESH MATERIALIZED VIEW matview' => {
all_runs => 1,
regexp => qr/^REFRESH MATERIALIZED VIEW matview;/m,
regexp => qr/^REFRESH MATERIALIZED VIEW dump_test.matview;/m,
like => {
clean => 1,
clean_if_exists => 1,
......@@ -6408,9 +6408,9 @@ qr/^GRANT SELECT ON TABLE measurement_y2006m2 TO regress_dump_test_role;/m,
'REFRESH MATERIALIZED VIEW matview_second' => {
all_runs => 1,
regexp => qr/^
\QREFRESH MATERIALIZED VIEW matview;\E
\QREFRESH MATERIALIZED VIEW dump_test.matview;\E
\n.*
\QREFRESH MATERIALIZED VIEW matview_second;\E
\QREFRESH MATERIALIZED VIEW dump_test.matview_second;\E
/xms,
like => {
clean => 1,
......@@ -6443,7 +6443,7 @@ qr/^GRANT SELECT ON TABLE measurement_y2006m2 TO regress_dump_test_role;/m,
'REFRESH MATERIALIZED VIEW matview_third' => {
all_runs => 1,
regexp => qr/^
\QREFRESH MATERIALIZED VIEW matview_third;\E
\QREFRESH MATERIALIZED VIEW dump_test.matview_third;\E
/xms,
like => {},
unlike => {
......@@ -6476,7 +6476,7 @@ qr/^GRANT SELECT ON TABLE measurement_y2006m2 TO regress_dump_test_role;/m,
'REFRESH MATERIALIZED VIEW matview_fourth' => {
all_runs => 1,
regexp => qr/^
\QREFRESH MATERIALIZED VIEW matview_fourth;\E
\QREFRESH MATERIALIZED VIEW dump_test.matview_fourth;\E
/xms,
like => {},
unlike => {
......@@ -6547,7 +6547,7 @@ qr/^GRANT SELECT ON TABLE measurement_y2006m2 TO regress_dump_test_role;/m,
create_sql => 'REVOKE EXECUTE ON FUNCTION pg_sleep(float8)
FROM public;',
regexp => qr/^
\QREVOKE ALL ON FUNCTION pg_sleep(double precision) FROM PUBLIC;\E
\QREVOKE ALL ON FUNCTION pg_catalog.pg_sleep(double precision) FROM PUBLIC;\E
/xm,
like => {
binary_upgrade => 1,
......@@ -6578,7 +6578,7 @@ qr/^GRANT SELECT ON TABLE measurement_y2006m2 TO regress_dump_test_role;/m,
catch_all => 'REVOKE commands',
create_order => 45,
create_sql => 'REVOKE SELECT ON TABLE pg_proc FROM public;',
regexp => qr/^REVOKE SELECT ON TABLE pg_proc FROM PUBLIC;/m,
regexp => qr/^REVOKE SELECT ON TABLE pg_catalog.pg_proc FROM PUBLIC;/m,
like => {
binary_upgrade => 1,
clean => 1,
......
......@@ -194,7 +194,7 @@ my %tests = (
create_sql =>
'ALTER EXTENSION test_pg_dump ADD TABLE regress_pg_dump_table_added;',
regexp => qr/^
\QCREATE TABLE regress_pg_dump_table_added (\E
\QCREATE TABLE public.regress_pg_dump_table_added (\E
\n\s+\Qcol1 integer NOT NULL,\E
\n\s+\Qcol2 integer\E
\n\);\n/xm,
......@@ -250,7 +250,7 @@ my %tests = (
'CREATE SEQUENCE regress_pg_dump_table_col1_seq' => {
regexp => qr/^
\QCREATE SEQUENCE regress_pg_dump_table_col1_seq\E
\QCREATE SEQUENCE public.regress_pg_dump_table_col1_seq\E
\n\s+\QAS integer\E
\n\s+\QSTART WITH 1\E
\n\s+\QINCREMENT BY 1\E
......@@ -276,7 +276,7 @@ my %tests = (
create_sql =>
'CREATE TABLE regress_pg_dump_table_added (col1 int not null, col2 int);',
regexp => qr/^
\QCREATE TABLE regress_pg_dump_table_added (\E
\QCREATE TABLE public.regress_pg_dump_table_added (\E
\n\s+\Qcol1 integer NOT NULL,\E
\n\s+\Qcol2 integer\E
\n\);\n/xm,
......@@ -295,7 +295,7 @@ my %tests = (
'CREATE SEQUENCE regress_pg_dump_seq' => {
regexp => qr/^
\QCREATE SEQUENCE regress_pg_dump_seq\E
\QCREATE SEQUENCE public.regress_pg_dump_seq\E
\n\s+\QSTART WITH 1\E
\n\s+\QINCREMENT BY 1\E
\n\s+\QNO MINVALUE\E
......@@ -319,7 +319,7 @@ my %tests = (
create_order => 6,
create_sql => qq{SELECT nextval('regress_seq_dumpable');},
regexp => qr/^
\QSELECT pg_catalog.setval('regress_seq_dumpable', 1, true);\E
\QSELECT pg_catalog.setval('public.regress_seq_dumpable', 1, true);\E
\n/xm,
like => {
clean => 1,
......@@ -337,7 +337,7 @@ my %tests = (
'CREATE TABLE regress_pg_dump_table' => {
regexp => qr/^
\QCREATE TABLE regress_pg_dump_table (\E
\QCREATE TABLE public.regress_pg_dump_table (\E
\n\s+\Qcol1 integer NOT NULL,\E
\n\s+\Qcol2 integer\E
\n\);\n/xm,
......@@ -395,7 +395,7 @@ my %tests = (
create_sql =>
'GRANT SELECT ON regress_pg_dump_table_added TO regress_dump_test_role;',
regexp => qr/^
\QGRANT SELECT ON TABLE regress_pg_dump_table_added TO regress_dump_test_role;\E
\QGRANT SELECT ON TABLE public.regress_pg_dump_table_added TO regress_dump_test_role;\E
\n/xm,
like => { binary_upgrade => 1, },
unlike => {
......@@ -415,7 +415,7 @@ my %tests = (
create_sql =>
'REVOKE SELECT ON regress_pg_dump_table_added FROM regress_dump_test_role;',
regexp => qr/^
\QREVOKE SELECT ON TABLE regress_pg_dump_table_added FROM regress_dump_test_role;\E
\QREVOKE SELECT ON TABLE public.regress_pg_dump_table_added FROM regress_dump_test_role;\E
\n/xm,
like => {
binary_upgrade => 1,
......@@ -434,7 +434,7 @@ my %tests = (
'GRANT SELECT ON TABLE regress_pg_dump_table' => {
regexp => qr/^
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\E\n
\QGRANT SELECT ON TABLE regress_pg_dump_table TO regress_dump_test_role;\E\n
\QGRANT SELECT ON TABLE public.regress_pg_dump_table TO regress_dump_test_role;\E\n
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\E
\n/xms,
like => { binary_upgrade => 1, },
......@@ -453,7 +453,7 @@ my %tests = (
'GRANT SELECT(col1) ON regress_pg_dump_table' => {
regexp => qr/^
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\E\n
\QGRANT SELECT(col1) ON TABLE regress_pg_dump_table TO PUBLIC;\E\n
\QGRANT SELECT(col1) ON TABLE public.regress_pg_dump_table TO PUBLIC;\E\n
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\E
\n/xms,
like => { binary_upgrade => 1, },
......@@ -474,7 +474,7 @@ my %tests = (
create_sql => 'GRANT SELECT(col2) ON regress_pg_dump_table
TO regress_dump_test_role;',
regexp => qr/^
\QGRANT SELECT(col2) ON TABLE regress_pg_dump_table TO regress_dump_test_role;\E
\QGRANT SELECT(col2) ON TABLE public.regress_pg_dump_table TO regress_dump_test_role;\E
\n/xm,
like => {
binary_upgrade => 1,
......@@ -496,7 +496,7 @@ my %tests = (
create_sql => 'GRANT USAGE ON SEQUENCE regress_pg_dump_table_col1_seq
TO regress_dump_test_role;',
regexp => qr/^
\QGRANT USAGE ON SEQUENCE regress_pg_dump_table_col1_seq TO regress_dump_test_role;\E
\QGRANT USAGE ON SEQUENCE public.regress_pg_dump_table_col1_seq TO regress_dump_test_role;\E
\n/xm,
like => {
binary_upgrade => 1,
......@@ -514,7 +514,7 @@ my %tests = (
'GRANT USAGE ON regress_pg_dump_seq TO regress_dump_test_role' => {
regexp => qr/^
\QGRANT USAGE ON SEQUENCE regress_pg_dump_seq TO regress_dump_test_role;\E
\QGRANT USAGE ON SEQUENCE public.regress_pg_dump_seq TO regress_dump_test_role;\E
\n/xm,
like => { binary_upgrade => 1, },
unlike => {
......@@ -534,7 +534,7 @@ my %tests = (
create_sql => 'REVOKE SELECT(col1) ON regress_pg_dump_table
FROM PUBLIC;',
regexp => qr/^
\QREVOKE SELECT(col1) ON TABLE regress_pg_dump_table FROM PUBLIC;\E
\QREVOKE SELECT(col1) ON TABLE public.regress_pg_dump_table FROM PUBLIC;\E
\n/xm,
like => {
binary_upgrade => 1,
......@@ -553,7 +553,7 @@ my %tests = (
# Objects included in extension part of a schema created by this extension */
'CREATE TABLE regress_pg_dump_schema.test_table' => {
regexp => qr/^
\QCREATE TABLE test_table (\E
\QCREATE TABLE regress_pg_dump_schema.test_table (\E
\n\s+\Qcol1 integer,\E
\n\s+\Qcol2 integer\E
\n\);\n/xm,
......@@ -573,7 +573,7 @@ my %tests = (
'GRANT SELECT ON regress_pg_dump_schema.test_table' => {
regexp => qr/^
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\E\n
\QGRANT SELECT ON TABLE test_table TO regress_dump_test_role;\E\n
\QGRANT SELECT ON TABLE regress_pg_dump_schema.test_table TO regress_dump_test_role;\E\n
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\E
\n/xms,
like => { binary_upgrade => 1, },
......@@ -591,7 +591,7 @@ my %tests = (
'CREATE SEQUENCE regress_pg_dump_schema.test_seq' => {
regexp => qr/^
\QCREATE SEQUENCE test_seq\E
\QCREATE SEQUENCE regress_pg_dump_schema.test_seq\E
\n\s+\QSTART WITH 1\E
\n\s+\QINCREMENT BY 1\E
\n\s+\QNO MINVALUE\E
......@@ -614,7 +614,7 @@ my %tests = (
'GRANT USAGE ON regress_pg_dump_schema.test_seq' => {
regexp => qr/^
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\E\n
\QGRANT USAGE ON SEQUENCE test_seq TO regress_dump_test_role;\E\n
\QGRANT USAGE ON SEQUENCE regress_pg_dump_schema.test_seq TO regress_dump_test_role;\E\n
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\E
\n/xms,
like => { binary_upgrade => 1, },
......@@ -632,7 +632,7 @@ my %tests = (
'CREATE TYPE regress_pg_dump_schema.test_type' => {
regexp => qr/^
\QCREATE TYPE test_type AS (\E
\QCREATE TYPE regress_pg_dump_schema.test_type AS (\E
\n\s+\Qcol1 integer\E
\n\);\n/xm,
like => { binary_upgrade => 1, },
......@@ -651,7 +651,7 @@ my %tests = (
'GRANT USAGE ON regress_pg_dump_schema.test_type' => {
regexp => qr/^
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\E\n
\QGRANT ALL ON TYPE test_type TO regress_dump_test_role;\E\n
\QGRANT ALL ON TYPE regress_pg_dump_schema.test_type TO regress_dump_test_role;\E\n
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\E
\n/xms,
like => { binary_upgrade => 1, },
......@@ -669,7 +669,7 @@ my %tests = (
'CREATE FUNCTION regress_pg_dump_schema.test_func' => {
regexp => qr/^
\QCREATE FUNCTION test_func() RETURNS integer\E
\QCREATE FUNCTION regress_pg_dump_schema.test_func() RETURNS integer\E
\n\s+\QLANGUAGE sql\E
\n/xm,
like => { binary_upgrade => 1, },
......@@ -688,7 +688,7 @@ my %tests = (
'GRANT ALL ON regress_pg_dump_schema.test_func' => {
regexp => qr/^
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\E\n
\QGRANT ALL ON FUNCTION test_func() TO regress_dump_test_role;\E\n
\QGRANT ALL ON FUNCTION regress_pg_dump_schema.test_func() TO regress_dump_test_role;\E\n
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\E
\n/xms,
like => { binary_upgrade => 1, },
......@@ -706,7 +706,7 @@ my %tests = (
'CREATE AGGREGATE regress_pg_dump_schema.test_agg' => {
regexp => qr/^
\QCREATE AGGREGATE test_agg(smallint) (\E
\QCREATE AGGREGATE regress_pg_dump_schema.test_agg(smallint) (\E
\n\s+\QSFUNC = int2_sum,\E
\n\s+\QSTYPE = bigint\E
\n\);\n/xm,
......@@ -726,7 +726,7 @@ my %tests = (
'GRANT ALL ON regress_pg_dump_schema.test_agg' => {
regexp => qr/^
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\E\n
\QGRANT ALL ON FUNCTION test_agg(smallint) TO regress_dump_test_role;\E\n
\QGRANT ALL ON FUNCTION regress_pg_dump_schema.test_agg(smallint) TO regress_dump_test_role;\E\n
\QSELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\E
\n/xms,
like => { binary_upgrade => 1, },
......@@ -748,7 +748,7 @@ my %tests = (
create_sql => 'CREATE TABLE regress_pg_dump_schema.external_tab
(col1 int);',
regexp => qr/^
\QCREATE TABLE external_tab (\E
\QCREATE TABLE regress_pg_dump_schema.external_tab (\E
\n\s+\Qcol1 integer\E
\n\);\n/xm,
like => {
......
......@@ -969,11 +969,11 @@ LINE 1: ...ATE INDEX collate_test1_idx6 ON collate_test1 ((a COLLATE "C...
^
SELECT relname, pg_get_indexdef(oid) FROM pg_class WHERE relname LIKE 'collate_test%_idx%' ORDER BY 1;
relname | pg_get_indexdef
--------------------+-----------------------------------------------------------------------------------------------------
collate_test1_idx1 | CREATE INDEX collate_test1_idx1 ON collate_test1 USING btree (b)
collate_test1_idx2 | CREATE INDEX collate_test1_idx2 ON collate_test1 USING btree (b COLLATE "C")
collate_test1_idx3 | CREATE INDEX collate_test1_idx3 ON collate_test1 USING btree (b COLLATE "C")
collate_test1_idx4 | CREATE INDEX collate_test1_idx4 ON collate_test1 USING btree (((b || 'foo'::text)) COLLATE "POSIX")
--------------------+-------------------------------------------------------------------------------------------------------------------
collate_test1_idx1 | CREATE INDEX collate_test1_idx1 ON collate_tests.collate_test1 USING btree (b)
collate_test1_idx2 | CREATE INDEX collate_test1_idx2 ON collate_tests.collate_test1 USING btree (b COLLATE "C")
collate_test1_idx3 | CREATE INDEX collate_test1_idx3 ON collate_tests.collate_test1 USING btree (b COLLATE "C")
collate_test1_idx4 | CREATE INDEX collate_test1_idx4 ON collate_tests.collate_test1 USING btree (((b || 'foo'::text)) COLLATE "POSIX")
(4 rows)
-- schema manipulation commands
......
......@@ -978,11 +978,11 @@ LINE 1: ...ATE INDEX collate_test1_idx6 ON collate_test1 ((a COLLATE "C...
^
SELECT relname, pg_get_indexdef(oid) FROM pg_class WHERE relname LIKE 'collate_test%_idx%' ORDER BY 1;
relname | pg_get_indexdef
--------------------+-----------------------------------------------------------------------------------------------------
collate_test1_idx1 | CREATE INDEX collate_test1_idx1 ON collate_test1 USING btree (b)
collate_test1_idx2 | CREATE INDEX collate_test1_idx2 ON collate_test1 USING btree (b COLLATE "C")
collate_test1_idx3 | CREATE INDEX collate_test1_idx3 ON collate_test1 USING btree (b COLLATE "C")
collate_test1_idx4 | CREATE INDEX collate_test1_idx4 ON collate_test1 USING btree (((b || 'foo'::text)) COLLATE "POSIX")
--------------------+-------------------------------------------------------------------------------------------------------------------
collate_test1_idx1 | CREATE INDEX collate_test1_idx1 ON collate_tests.collate_test1 USING btree (b)
collate_test1_idx2 | CREATE INDEX collate_test1_idx2 ON collate_tests.collate_test1 USING btree (b COLLATE "C")
collate_test1_idx3 | CREATE INDEX collate_test1_idx3 ON collate_tests.collate_test1 USING btree (b COLLATE "C")
collate_test1_idx4 | CREATE INDEX collate_test1_idx4 ON collate_tests.collate_test1 USING btree (((b || 'foo'::text)) COLLATE "POSIX")
(4 rows)
-- schema manipulation commands
......
......@@ -573,11 +573,11 @@ LINE 1: ...ATE INDEX collate_test1_idx6 ON collate_test1 ((a COLLATE "P...
^
SELECT relname, pg_get_indexdef(oid) FROM pg_class WHERE relname LIKE 'collate_test%_idx%' ORDER BY 1;
relname | pg_get_indexdef
--------------------+-----------------------------------------------------------------------------------------------------
collate_test1_idx1 | CREATE INDEX collate_test1_idx1 ON collate_test1 USING btree (b)
collate_test1_idx2 | CREATE INDEX collate_test1_idx2 ON collate_test1 USING btree (b COLLATE "POSIX")
collate_test1_idx3 | CREATE INDEX collate_test1_idx3 ON collate_test1 USING btree (b COLLATE "POSIX")
collate_test1_idx4 | CREATE INDEX collate_test1_idx4 ON collate_test1 USING btree (((b || 'foo'::text)) COLLATE "POSIX")
--------------------+-------------------------------------------------------------------------------------------------------------------
collate_test1_idx1 | CREATE INDEX collate_test1_idx1 ON collate_tests.collate_test1 USING btree (b)
collate_test1_idx2 | CREATE INDEX collate_test1_idx2 ON collate_tests.collate_test1 USING btree (b COLLATE "POSIX")
collate_test1_idx3 | CREATE INDEX collate_test1_idx3 ON collate_tests.collate_test1 USING btree (b COLLATE "POSIX")
collate_test1_idx4 | CREATE INDEX collate_test1_idx4 ON collate_tests.collate_test1 USING btree (((b || 'foo'::text)) COLLATE "POSIX")
(4 rows)
-- foreign keys
......
......@@ -488,10 +488,10 @@ select relname as child, inhparent::regclass as parent, pg_get_indexdef as child
lateral pg_get_indexdef(pg_class.oid)
where relkind in ('i', 'I') and relname like 'idxpart%' order by relname;
child | parent | childdef
-------------------+------------------+--------------------------------------------------------------------
idxpart1_expr_idx | idxpart_expr_idx | CREATE INDEX idxpart1_expr_idx ON idxpart1 USING btree (((a + b)))
idxpart2_expr_idx | idxpart_expr_idx | CREATE INDEX idxpart2_expr_idx ON idxpart2 USING btree (((a + b)))
idxpart3_expr_idx | idxpart_expr_idx | CREATE INDEX idxpart3_expr_idx ON idxpart3 USING btree (((a + b)))
-------------------+------------------+---------------------------------------------------------------------------
idxpart1_expr_idx | idxpart_expr_idx | CREATE INDEX idxpart1_expr_idx ON public.idxpart1 USING btree (((a + b)))
idxpart2_expr_idx | idxpart_expr_idx | CREATE INDEX idxpart2_expr_idx ON public.idxpart2 USING btree (((a + b)))
idxpart3_expr_idx | idxpart_expr_idx | CREATE INDEX idxpart3_expr_idx ON public.idxpart3 USING btree (((a + b)))
(3 rows)
drop table idxpart;
......@@ -512,14 +512,14 @@ select relname as child, inhparent::regclass as parent, pg_get_indexdef as child
lateral pg_get_indexdef(pg_class.oid)
where relkind in ('i', 'I') and relname like 'idxpart%' order by relname;
child | parent | childdef
-----------------+---------------+-------------------------------------------------------------------------
idxpart1_a_idx | idxpart_a_idx | CREATE INDEX idxpart1_a_idx ON idxpart1 USING btree (a COLLATE "C")
idxpart2_a_idx | | CREATE INDEX idxpart2_a_idx ON idxpart2 USING btree (a COLLATE "POSIX")
idxpart2_a_idx1 | | CREATE INDEX idxpart2_a_idx1 ON idxpart2 USING btree (a)
idxpart2_a_idx2 | idxpart_a_idx | CREATE INDEX idxpart2_a_idx2 ON idxpart2 USING btree (a COLLATE "C")
idxpart3_a_idx | idxpart_a_idx | CREATE INDEX idxpart3_a_idx ON idxpart3 USING btree (a COLLATE "C")
idxpart4_a_idx | idxpart_a_idx | CREATE INDEX idxpart4_a_idx ON idxpart4 USING btree (a COLLATE "C")
idxpart_a_idx | | CREATE INDEX idxpart_a_idx ON ONLY idxpart USING btree (a COLLATE "C")
-----------------+---------------+--------------------------------------------------------------------------------
idxpart1_a_idx | idxpart_a_idx | CREATE INDEX idxpart1_a_idx ON public.idxpart1 USING btree (a COLLATE "C")
idxpart2_a_idx | | CREATE INDEX idxpart2_a_idx ON public.idxpart2 USING btree (a COLLATE "POSIX")
idxpart2_a_idx1 | | CREATE INDEX idxpart2_a_idx1 ON public.idxpart2 USING btree (a)
idxpart2_a_idx2 | idxpart_a_idx | CREATE INDEX idxpart2_a_idx2 ON public.idxpart2 USING btree (a COLLATE "C")
idxpart3_a_idx | idxpart_a_idx | CREATE INDEX idxpart3_a_idx ON public.idxpart3 USING btree (a COLLATE "C")
idxpart4_a_idx | idxpart_a_idx | CREATE INDEX idxpart4_a_idx ON public.idxpart4 USING btree (a COLLATE "C")
idxpart_a_idx | | CREATE INDEX idxpart_a_idx ON ONLY public.idxpart USING btree (a COLLATE "C")
(7 rows)
drop table idxpart;
......@@ -539,13 +539,13 @@ select relname as child, inhparent::regclass as parent, pg_get_indexdef as child
lateral pg_get_indexdef(pg_class.oid)
where relkind in ('i', 'I') and relname like 'idxpart%' order by relname;
child | parent | childdef
-----------------+---------------+-----------------------------------------------------------------------------
idxpart1_a_idx | idxpart_a_idx | CREATE INDEX idxpart1_a_idx ON idxpart1 USING btree (a text_pattern_ops)
idxpart2_a_idx | | CREATE INDEX idxpart2_a_idx ON idxpart2 USING btree (a)
idxpart2_a_idx1 | idxpart_a_idx | CREATE INDEX idxpart2_a_idx1 ON idxpart2 USING btree (a text_pattern_ops)
idxpart3_a_idx | idxpart_a_idx | CREATE INDEX idxpart3_a_idx ON idxpart3 USING btree (a text_pattern_ops)
idxpart4_a_idx | idxpart_a_idx | CREATE INDEX idxpart4_a_idx ON idxpart4 USING btree (a text_pattern_ops)
idxpart_a_idx | | CREATE INDEX idxpart_a_idx ON ONLY idxpart USING btree (a text_pattern_ops)
-----------------+---------------+------------------------------------------------------------------------------------
idxpart1_a_idx | idxpart_a_idx | CREATE INDEX idxpart1_a_idx ON public.idxpart1 USING btree (a text_pattern_ops)
idxpart2_a_idx | | CREATE INDEX idxpart2_a_idx ON public.idxpart2 USING btree (a)
idxpart2_a_idx1 | idxpart_a_idx | CREATE INDEX idxpart2_a_idx1 ON public.idxpart2 USING btree (a text_pattern_ops)
idxpart3_a_idx | idxpart_a_idx | CREATE INDEX idxpart3_a_idx ON public.idxpart3 USING btree (a text_pattern_ops)
idxpart4_a_idx | idxpart_a_idx | CREATE INDEX idxpart4_a_idx ON public.idxpart4 USING btree (a text_pattern_ops)
idxpart_a_idx | | CREATE INDEX idxpart_a_idx ON ONLY public.idxpart USING btree (a text_pattern_ops)
(6 rows)
drop index idxpart_a_idx;
......@@ -585,14 +585,14 @@ select relname as child, inhparent::regclass as parent, pg_get_indexdef as child
lateral pg_get_indexdef(pg_class.oid)
where relkind in ('i', 'I') and relname like 'idxpart%' order by relname;
child | parent | childdef
-----------------+---------------+----------------------------------------------------------------------------------
idxpart1_1_idx | idxpart_1_idx | CREATE INDEX idxpart1_1_idx ON idxpart1 USING btree (b, a)
idxpart1_1b_idx | | CREATE INDEX idxpart1_1b_idx ON idxpart1 USING btree (b)
idxpart1_2_idx | idxpart_2_idx | CREATE INDEX idxpart1_2_idx ON idxpart1 USING btree (((b + a))) WHERE (a > 1)
idxpart1_2b_idx | | CREATE INDEX idxpart1_2b_idx ON idxpart1 USING btree (((a + b))) WHERE (a > 1)
idxpart1_2c_idx | | CREATE INDEX idxpart1_2c_idx ON idxpart1 USING btree (((b + a))) WHERE (b > 1)
idxpart_1_idx | | CREATE INDEX idxpart_1_idx ON ONLY idxpart USING btree (b, a)
idxpart_2_idx | | CREATE INDEX idxpart_2_idx ON ONLY idxpart USING btree (((b + a))) WHERE (a > 1)
-----------------+---------------+-----------------------------------------------------------------------------------------
idxpart1_1_idx | idxpart_1_idx | CREATE INDEX idxpart1_1_idx ON public.idxpart1 USING btree (b, a)
idxpart1_1b_idx | | CREATE INDEX idxpart1_1b_idx ON public.idxpart1 USING btree (b)
idxpart1_2_idx | idxpart_2_idx | CREATE INDEX idxpart1_2_idx ON public.idxpart1 USING btree (((b + a))) WHERE (a > 1)
idxpart1_2b_idx | | CREATE INDEX idxpart1_2b_idx ON public.idxpart1 USING btree (((a + b))) WHERE (a > 1)
idxpart1_2c_idx | | CREATE INDEX idxpart1_2c_idx ON public.idxpart1 USING btree (((b + a))) WHERE (b > 1)
idxpart_1_idx | | CREATE INDEX idxpart_1_idx ON ONLY public.idxpart USING btree (b, a)
idxpart_2_idx | | CREATE INDEX idxpart_2_idx ON ONLY public.idxpart USING btree (((b + a))) WHERE (a > 1)
(7 rows)
drop table idxpart;
......@@ -611,13 +611,13 @@ select c.relname, pg_get_indexdef(indexrelid)
where indrelid::regclass::text like 'idxpart%'
order by indexrelid::regclass::text collate "C";
relname | pg_get_indexdef
------------------+--------------------------------------------------------------
idxpart1_a_idx | CREATE INDEX idxpart1_a_idx ON idxpart1 USING btree (a)
idxpart1_c_b_idx | CREATE INDEX idxpart1_c_b_idx ON idxpart1 USING btree (c, b)
idxpart2_a_idx | CREATE INDEX idxpart2_a_idx ON idxpart2 USING btree (a)
idxpart2_c_b_idx | CREATE INDEX idxpart2_c_b_idx ON idxpart2 USING btree (c, b)
idxparti | CREATE INDEX idxparti ON ONLY idxpart USING btree (a)
idxparti2 | CREATE INDEX idxparti2 ON ONLY idxpart USING btree (c, b)
------------------+---------------------------------------------------------------------
idxpart1_a_idx | CREATE INDEX idxpart1_a_idx ON public.idxpart1 USING btree (a)
idxpart1_c_b_idx | CREATE INDEX idxpart1_c_b_idx ON public.idxpart1 USING btree (c, b)
idxpart2_a_idx | CREATE INDEX idxpart2_a_idx ON public.idxpart2 USING btree (a)
idxpart2_c_b_idx | CREATE INDEX idxpart2_c_b_idx ON public.idxpart2 USING btree (c, b)
idxparti | CREATE INDEX idxparti ON ONLY public.idxpart USING btree (a)
idxparti2 | CREATE INDEX idxparti2 ON ONLY public.idxpart USING btree (c, b)
(6 rows)
drop table idxpart;
......@@ -637,10 +637,10 @@ select c.relname, pg_get_indexdef(indexrelid)
where indrelid::regclass::text like 'idxpart%'
order by indexrelid::regclass::text collate "C";
relname | pg_get_indexdef
------------------+-------------------------------------------------------------------
idxpart1_abs_idx | CREATE INDEX idxpart1_abs_idx ON idxpart1 USING btree (abs(b))
idxpart2_abs_idx | CREATE INDEX idxpart2_abs_idx ON idxpart2 USING btree (abs(b))
idxpart_abs_idx | CREATE INDEX idxpart_abs_idx ON ONLY idxpart USING btree (abs(b))
------------------+--------------------------------------------------------------------------
idxpart1_abs_idx | CREATE INDEX idxpart1_abs_idx ON public.idxpart1 USING btree (abs(b))
idxpart2_abs_idx | CREATE INDEX idxpart2_abs_idx ON public.idxpart2 USING btree (abs(b))
idxpart_abs_idx | CREATE INDEX idxpart_abs_idx ON ONLY public.idxpart USING btree (abs(b))
(3 rows)
drop table idxpart;
......@@ -660,10 +660,10 @@ select c.relname, pg_get_indexdef(indexrelid)
where indrelid::regclass::text like 'idxpart%'
order by indexrelid::regclass::text collate "C";
relname | pg_get_indexdef
----------------+-----------------------------------------------------------------------------
idxpart1_a_idx | CREATE INDEX idxpart1_a_idx ON idxpart1 USING btree (a) WHERE (b > 1000)
idxpart2_a_idx | CREATE INDEX idxpart2_a_idx ON idxpart2 USING btree (a) WHERE (b > 1000)
idxpart_a_idx | CREATE INDEX idxpart_a_idx ON ONLY idxpart USING btree (a) WHERE (b > 1000)
----------------+------------------------------------------------------------------------------------
idxpart1_a_idx | CREATE INDEX idxpart1_a_idx ON public.idxpart1 USING btree (a) WHERE (b > 1000)
idxpart2_a_idx | CREATE INDEX idxpart2_a_idx ON public.idxpart2 USING btree (a) WHERE (b > 1000)
idxpart_a_idx | CREATE INDEX idxpart_a_idx ON ONLY public.idxpart USING btree (a) WHERE (b > 1000)
(3 rows)
drop table idxpart;
......
......@@ -2342,103 +2342,103 @@ toyemp| SELECT emp.name,
SELECT tablename, rulename, definition FROM pg_rules
ORDER BY tablename, rulename;
pg_settings|pg_settings_n|CREATE RULE pg_settings_n AS
ON UPDATE TO pg_settings DO INSTEAD NOTHING;
ON UPDATE TO pg_catalog.pg_settings DO INSTEAD NOTHING;
pg_settings|pg_settings_u|CREATE RULE pg_settings_u AS
ON UPDATE TO pg_settings
ON UPDATE TO pg_catalog.pg_settings
WHERE (new.name = old.name) DO SELECT set_config(old.name, new.setting, false) AS set_config;
rtest_emp|rtest_emp_del|CREATE RULE rtest_emp_del AS
ON DELETE TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal)
ON DELETE TO public.rtest_emp DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal)
VALUES (old.ename, CURRENT_USER, 'fired'::bpchar, '$0.00'::money, old.salary);
rtest_emp|rtest_emp_ins|CREATE RULE rtest_emp_ins AS
ON INSERT TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal)
ON INSERT TO public.rtest_emp DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal)
VALUES (new.ename, CURRENT_USER, 'hired'::bpchar, new.salary, '$0.00'::money);
rtest_emp|rtest_emp_upd|CREATE RULE rtest_emp_upd AS
ON UPDATE TO rtest_emp
ON UPDATE TO public.rtest_emp
WHERE (new.salary <> old.salary) DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal)
VALUES (new.ename, CURRENT_USER, 'honored'::bpchar, new.salary, old.salary);
rtest_nothn1|rtest_nothn_r1|CREATE RULE rtest_nothn_r1 AS
ON INSERT TO rtest_nothn1
ON INSERT TO public.rtest_nothn1
WHERE ((new.a >= 10) AND (new.a < 20)) DO INSTEAD NOTHING;
rtest_nothn1|rtest_nothn_r2|CREATE RULE rtest_nothn_r2 AS
ON INSERT TO rtest_nothn1
ON INSERT TO public.rtest_nothn1
WHERE ((new.a >= 30) AND (new.a < 40)) DO INSTEAD NOTHING;
rtest_nothn2|rtest_nothn_r3|CREATE RULE rtest_nothn_r3 AS
ON INSERT TO rtest_nothn2
ON INSERT TO public.rtest_nothn2
WHERE (new.a >= 100) DO INSTEAD INSERT INTO rtest_nothn3 (a, b)
VALUES (new.a, new.b);
rtest_nothn2|rtest_nothn_r4|CREATE RULE rtest_nothn_r4 AS
ON INSERT TO rtest_nothn2 DO INSTEAD NOTHING;
ON INSERT TO public.rtest_nothn2 DO INSTEAD NOTHING;
rtest_order1|rtest_order_r1|CREATE RULE rtest_order_r1 AS
ON INSERT TO rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c)
ON INSERT TO public.rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c)
VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 1 - this should run 1st'::text);
rtest_order1|rtest_order_r2|CREATE RULE rtest_order_r2 AS
ON INSERT TO rtest_order1 DO INSERT INTO rtest_order2 (a, b, c)
ON INSERT TO public.rtest_order1 DO INSERT INTO rtest_order2 (a, b, c)
VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 2 - this should run 2nd'::text);
rtest_order1|rtest_order_r3|CREATE RULE rtest_order_r3 AS
ON INSERT TO rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c)
ON INSERT TO public.rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c)
VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 3 - this should run 3rd'::text);
rtest_order1|rtest_order_r4|CREATE RULE rtest_order_r4 AS
ON INSERT TO rtest_order1
ON INSERT TO public.rtest_order1
WHERE (new.a < 100) DO INSTEAD INSERT INTO rtest_order2 (a, b, c)
VALUES (new.a, nextval('rtest_seq'::regclass), 'rule 4 - this should run 4th'::text);
rtest_person|rtest_pers_del|CREATE RULE rtest_pers_del AS
ON DELETE TO rtest_person DO DELETE FROM rtest_admin
ON DELETE TO public.rtest_person DO DELETE FROM rtest_admin
WHERE (rtest_admin.pname = old.pname);
rtest_person|rtest_pers_upd|CREATE RULE rtest_pers_upd AS
ON UPDATE TO rtest_person DO UPDATE rtest_admin SET pname = new.pname
ON UPDATE TO public.rtest_person DO UPDATE rtest_admin SET pname = new.pname
WHERE (rtest_admin.pname = old.pname);
rtest_system|rtest_sys_del|CREATE RULE rtest_sys_del AS
ON DELETE TO rtest_system DO ( DELETE FROM rtest_interface
ON DELETE TO public.rtest_system DO ( DELETE FROM rtest_interface
WHERE (rtest_interface.sysname = old.sysname);
DELETE FROM rtest_admin
WHERE (rtest_admin.sysname = old.sysname);
);
rtest_system|rtest_sys_upd|CREATE RULE rtest_sys_upd AS
ON UPDATE TO rtest_system DO ( UPDATE rtest_interface SET sysname = new.sysname
ON UPDATE TO public.rtest_system DO ( UPDATE rtest_interface SET sysname = new.sysname
WHERE (rtest_interface.sysname = old.sysname);
UPDATE rtest_admin SET sysname = new.sysname
WHERE (rtest_admin.sysname = old.sysname);
);
rtest_t4|rtest_t4_ins1|CREATE RULE rtest_t4_ins1 AS
ON INSERT TO rtest_t4
ON INSERT TO public.rtest_t4
WHERE ((new.a >= 10) AND (new.a < 20)) DO INSTEAD INSERT INTO rtest_t5 (a, b)
VALUES (new.a, new.b);
rtest_t4|rtest_t4_ins2|CREATE RULE rtest_t4_ins2 AS
ON INSERT TO rtest_t4
ON INSERT TO public.rtest_t4
WHERE ((new.a >= 20) AND (new.a < 30)) DO INSERT INTO rtest_t6 (a, b)
VALUES (new.a, new.b);
rtest_t5|rtest_t5_ins|CREATE RULE rtest_t5_ins AS
ON INSERT TO rtest_t5
ON INSERT TO public.rtest_t5
WHERE (new.a > 15) DO INSERT INTO rtest_t7 (a, b)
VALUES (new.a, new.b);
rtest_t6|rtest_t6_ins|CREATE RULE rtest_t6_ins AS
ON INSERT TO rtest_t6
ON INSERT TO public.rtest_t6
WHERE (new.a > 25) DO INSTEAD INSERT INTO rtest_t8 (a, b)
VALUES (new.a, new.b);
rtest_v1|rtest_v1_del|CREATE RULE rtest_v1_del AS
ON DELETE TO rtest_v1 DO INSTEAD DELETE FROM rtest_t1
ON DELETE TO public.rtest_v1 DO INSTEAD DELETE FROM rtest_t1
WHERE (rtest_t1.a = old.a);
rtest_v1|rtest_v1_ins|CREATE RULE rtest_v1_ins AS
ON INSERT TO rtest_v1 DO INSTEAD INSERT INTO rtest_t1 (a, b)
ON INSERT TO public.rtest_v1 DO INSTEAD INSERT INTO rtest_t1 (a, b)
VALUES (new.a, new.b);
rtest_v1|rtest_v1_upd|CREATE RULE rtest_v1_upd AS
ON UPDATE TO rtest_v1 DO INSTEAD UPDATE rtest_t1 SET a = new.a, b = new.b
ON UPDATE TO public.rtest_v1 DO INSTEAD UPDATE rtest_t1 SET a = new.a, b = new.b
WHERE (rtest_t1.a = old.a);
shoelace|shoelace_del|CREATE RULE shoelace_del AS
ON DELETE TO shoelace DO INSTEAD DELETE FROM shoelace_data
ON DELETE TO public.shoelace DO INSTEAD DELETE FROM shoelace_data
WHERE (shoelace_data.sl_name = old.sl_name);
shoelace|shoelace_ins|CREATE RULE shoelace_ins AS
ON INSERT TO shoelace DO INSTEAD INSERT INTO shoelace_data (sl_name, sl_avail, sl_color, sl_len, sl_unit)
ON INSERT TO public.shoelace DO INSTEAD INSERT INTO shoelace_data (sl_name, sl_avail, sl_color, sl_len, sl_unit)
VALUES (new.sl_name, new.sl_avail, new.sl_color, new.sl_len, new.sl_unit);
shoelace|shoelace_upd|CREATE RULE shoelace_upd AS
ON UPDATE TO shoelace DO INSTEAD UPDATE shoelace_data SET sl_name = new.sl_name, sl_avail = new.sl_avail, sl_color = new.sl_color, sl_len = new.sl_len, sl_unit = new.sl_unit
ON UPDATE TO public.shoelace DO INSTEAD UPDATE shoelace_data SET sl_name = new.sl_name, sl_avail = new.sl_avail, sl_color = new.sl_color, sl_len = new.sl_len, sl_unit = new.sl_unit
WHERE (shoelace_data.sl_name = old.sl_name);
shoelace_data|log_shoelace|CREATE RULE log_shoelace AS
ON UPDATE TO shoelace_data
ON UPDATE TO public.shoelace_data
WHERE (new.sl_avail <> old.sl_avail) DO INSERT INTO shoelace_log (sl_name, sl_avail, log_who, log_when)
VALUES (new.sl_name, new.sl_avail, 'Al Bundy'::name, 'Thu Jan 01 00:00:00 1970'::timestamp without time zone);
shoelace_ok|shoelace_ok_ins|CREATE RULE shoelace_ok_ins AS
ON INSERT TO shoelace_ok DO INSTEAD UPDATE shoelace SET sl_avail = (shoelace.sl_avail + new.ok_quant)
ON INSERT TO public.shoelace_ok DO INSTEAD UPDATE shoelace SET sl_avail = (shoelace.sl_avail + new.ok_quant)
WHERE (shoelace.sl_name = new.ok_name);
-- restore normal output mode
\a\t
......@@ -2961,7 +2961,7 @@ SELECT definition FROM pg_rules WHERE tablename = 'hats' ORDER BY rulename;
definition
---------------------------------------------------------------------------------------------
CREATE RULE hat_nosert AS +
ON INSERT TO hats DO INSTEAD INSERT INTO hat_data (hat_name, hat_color) +
ON INSERT TO public.hats DO INSTEAD INSERT INTO hat_data (hat_name, hat_color) +
VALUES (new.hat_name, new.hat_color) ON CONFLICT(hat_name COLLATE "C" bpchar_pattern_ops)+
WHERE (hat_color = 'green'::bpchar) DO NOTHING +
RETURNING hat_data.hat_name, +
......@@ -2986,7 +2986,7 @@ SELECT tablename, rulename, definition FROM pg_rules
tablename | rulename | definition
-----------+------------+---------------------------------------------------------------------------------------------
hats | hat_nosert | CREATE RULE hat_nosert AS +
| | ON INSERT TO hats DO INSTEAD INSERT INTO hat_data (hat_name, hat_color) +
| | ON INSERT TO public.hats DO INSTEAD INSERT INTO hat_data (hat_name, hat_color) +
| | VALUES (new.hat_name, new.hat_color) ON CONFLICT(hat_name COLLATE "C" bpchar_pattern_ops)+
| | WHERE (hat_color = 'green'::bpchar) DO NOTHING +
| | RETURNING hat_data.hat_name, +
......@@ -3005,9 +3005,9 @@ CREATE RULE hat_nosert_all AS ON INSERT TO hats
RETURNING *;
SELECT definition FROM pg_rules WHERE tablename = 'hats' ORDER BY rulename;
definition
------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
CREATE RULE hat_nosert_all AS +
ON INSERT TO hats DO INSTEAD INSERT INTO hat_data (hat_name, hat_color)+
ON INSERT TO public.hats DO INSTEAD INSERT INTO hat_data (hat_name, hat_color)+
VALUES (new.hat_name, new.hat_color) ON CONFLICT DO NOTHING +
RETURNING hat_data.hat_name, +
hat_data.hat_color;
......@@ -3036,7 +3036,7 @@ SELECT definition FROM pg_rules WHERE tablename = 'hats' ORDER BY rulename;
definition
-----------------------------------------------------------------------------------------------------------------------------------------
CREATE RULE hat_upsert AS +
ON INSERT TO hats DO INSTEAD INSERT INTO hat_data (hat_name, hat_color) +
ON INSERT TO public.hats DO INSTEAD INSERT INTO hat_data (hat_name, hat_color) +
VALUES (new.hat_name, new.hat_color) ON CONFLICT(hat_name) DO UPDATE SET hat_name = hat_data.hat_name, hat_color = excluded.hat_color+
WHERE ((excluded.hat_color <> 'forbidden'::bpchar) AND (hat_data.* <> excluded.*)) +
RETURNING hat_data.hat_name, +
......@@ -3084,7 +3084,7 @@ SELECT tablename, rulename, definition FROM pg_rules
tablename | rulename | definition
-----------+------------+-----------------------------------------------------------------------------------------------------------------------------------------
hats | hat_upsert | CREATE RULE hat_upsert AS +
| | ON INSERT TO hats DO INSTEAD INSERT INTO hat_data (hat_name, hat_color) +
| | ON INSERT TO public.hats DO INSTEAD INSERT INTO hat_data (hat_name, hat_color) +
| | VALUES (new.hat_name, new.hat_color) ON CONFLICT(hat_name) DO UPDATE SET hat_name = hat_data.hat_name, hat_color = excluded.hat_color+
| | WHERE ((excluded.hat_color <> 'forbidden'::bpchar) AND (hat_data.* <> excluded.*)) +
| | RETURNING hat_data.hat_name, +
......
......@@ -432,8 +432,8 @@ SELECT pg_get_triggerdef(oid, true) FROM pg_trigger WHERE tgrelid = 'main_table'
SELECT pg_get_triggerdef(oid, false) FROM pg_trigger WHERE tgrelid = 'main_table'::regclass AND tgname = 'modified_a';
pg_get_triggerdef
----------------------------------------------------------------------------------------------------------------------------------------------
CREATE TRIGGER modified_a BEFORE UPDATE OF a ON main_table FOR EACH ROW WHEN ((old.a <> new.a)) EXECUTE PROCEDURE trigger_func('modified_a')
-----------------------------------------------------------------------------------------------------------------------------------------------------
CREATE TRIGGER modified_a BEFORE UPDATE OF a ON public.main_table FOR EACH ROW WHEN ((old.a <> new.a)) EXECUTE PROCEDURE trigger_func('modified_a')
(1 row)
SELECT pg_get_triggerdef(oid, true) FROM pg_trigger WHERE tgrelid = 'main_table'::regclass AND tgname = 'modified_any';
......@@ -462,8 +462,8 @@ CREATE TRIGGER after_upd_b_stmt_trig AFTER UPDATE OF b ON main_table
FOR EACH STATEMENT EXECUTE PROCEDURE trigger_func('after_upd_b_stmt');
SELECT pg_get_triggerdef(oid) FROM pg_trigger WHERE tgrelid = 'main_table'::regclass AND tgname = 'after_upd_a_b_row_trig';
pg_get_triggerdef
-------------------------------------------------------------------------------------------------------------------------------------------
CREATE TRIGGER after_upd_a_b_row_trig AFTER UPDATE OF a, b ON main_table FOR EACH ROW EXECUTE PROCEDURE trigger_func('after_upd_a_b_row')
--------------------------------------------------------------------------------------------------------------------------------------------------
CREATE TRIGGER after_upd_a_b_row_trig AFTER UPDATE OF a, b ON public.main_table FOR EACH ROW EXECUTE PROCEDURE trigger_func('after_upd_a_b_row')
(1 row)
UPDATE main_table SET a = 50;
......
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