1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-03 22:24:49 +03:00

Message improvements

This commit is contained in:
Peter Eisentraut 2015-11-16 21:16:42 -05:00
parent 75c8af902e
commit 689cabf402
26 changed files with 76 additions and 80 deletions

View File

@ -842,12 +842,12 @@ ParallelWorkerMain(Datum main_arg)
if (seg == NULL) if (seg == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("unable to map dynamic shared memory segment"))); errmsg("could not map dynamic shared memory segment")));
toc = shm_toc_attach(PARALLEL_MAGIC, dsm_segment_address(seg)); toc = shm_toc_attach(PARALLEL_MAGIC, dsm_segment_address(seg));
if (toc == NULL) if (toc == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("bad magic number in dynamic shared memory segment"))); errmsg("invalid magic number in dynamic shared memory segment")));
/* Look up fixed parallel state. */ /* Look up fixed parallel state. */
fps = shm_toc_lookup(toc, PARALLEL_KEY_FIXED); fps = shm_toc_lookup(toc, PARALLEL_KEY_FIXED);
@ -998,7 +998,7 @@ ParallelExtensionTrampoline(dsm_segment *seg, shm_toc *toc)
static void static void
ParallelErrorContext(void *arg) ParallelErrorContext(void *arg)
{ {
errcontext("parallel worker, pid %d", *(int32 *) arg); errcontext("parallel worker, PID %d", *(int32 *) arg);
} }
/* /*

View File

@ -4976,9 +4976,10 @@ readRecoveryCommandFile(void)
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid value for recovery parameter \"%s\"", errmsg("invalid value for recovery parameter \"%s\": \"%s\"",
"recovery_target_action"), "recovery_target_action",
errhint("The allowed values are \"pause\", \"promote\", and \"shutdown\"."))); item->value),
errhint("Valid values are \"pause\", \"promote\", and \"shutdown\".")));
ereport(DEBUG2, ereport(DEBUG2,
(errmsg_internal("recovery_target_action = '%s'", (errmsg_internal("recovery_target_action = '%s'",
@ -5058,7 +5059,9 @@ readRecoveryCommandFile(void)
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid value for recovery parameter \"recovery_target\""), errmsg("invalid value for recovery parameter \"%s\": \"%s\"",
"recovery_target",
item->value),
errhint("The only allowed value is \"immediate\"."))); errhint("The only allowed value is \"immediate\".")));
ereport(DEBUG2, ereport(DEBUG2,
(errmsg_internal("recovery_target = '%s'", (errmsg_internal("recovery_target = '%s'",
@ -6142,7 +6145,7 @@ StartupXLOG(void)
unlink(TABLESPACE_MAP_OLD); unlink(TABLESPACE_MAP_OLD);
if (rename(TABLESPACE_MAP, TABLESPACE_MAP_OLD) == 0) if (rename(TABLESPACE_MAP, TABLESPACE_MAP_OLD) == 0)
ereport(LOG, ereport(LOG,
(errmsg("ignoring \"%s\" file because no \"%s\" file exists", (errmsg("ignoring file \"%s\" because no file \"%s\" exists",
TABLESPACE_MAP, BACKUP_LABEL_FILE), TABLESPACE_MAP, BACKUP_LABEL_FILE),
errdetail("File \"%s\" was renamed to \"%s\".", errdetail("File \"%s\" was renamed to \"%s\".",
TABLESPACE_MAP, TABLESPACE_MAP_OLD))); TABLESPACE_MAP, TABLESPACE_MAP_OLD)));
@ -6150,7 +6153,7 @@ StartupXLOG(void)
ereport(LOG, ereport(LOG,
(errmsg("ignoring \"%s\" file because no \"%s\" file exists", (errmsg("ignoring \"%s\" file because no \"%s\" file exists",
TABLESPACE_MAP, BACKUP_LABEL_FILE), TABLESPACE_MAP, BACKUP_LABEL_FILE),
errdetail("File \"%s\" could not be renamed to \"%s\": %m.", errdetail("Could not rename file \"%s\" to \"%s\": %m.",
TABLESPACE_MAP, TABLESPACE_MAP_OLD))); TABLESPACE_MAP, TABLESPACE_MAP_OLD)));
} }
@ -6281,24 +6284,24 @@ StartupXLOG(void)
LastRec = RecPtr = checkPointLoc; LastRec = RecPtr = checkPointLoc;
ereport(DEBUG1, ereport(DEBUG1,
(errmsg("redo record is at %X/%X; shutdown %s", (errmsg_internal("redo record is at %X/%X; shutdown %s",
(uint32) (checkPoint.redo >> 32), (uint32) checkPoint.redo, (uint32) (checkPoint.redo >> 32), (uint32) checkPoint.redo,
wasShutdown ? "TRUE" : "FALSE"))); wasShutdown ? "TRUE" : "FALSE")));
ereport(DEBUG1, ereport(DEBUG1,
(errmsg("next transaction ID: %u/%u; next OID: %u", (errmsg_internal("next transaction ID: %u/%u; next OID: %u",
checkPoint.nextXidEpoch, checkPoint.nextXid, checkPoint.nextXidEpoch, checkPoint.nextXid,
checkPoint.nextOid))); checkPoint.nextOid)));
ereport(DEBUG1, ereport(DEBUG1,
(errmsg("next MultiXactId: %u; next MultiXactOffset: %u", (errmsg_internal("next MultiXactId: %u; next MultiXactOffset: %u",
checkPoint.nextMulti, checkPoint.nextMultiOffset))); checkPoint.nextMulti, checkPoint.nextMultiOffset)));
ereport(DEBUG1, ereport(DEBUG1,
(errmsg("oldest unfrozen transaction ID: %u, in database %u", (errmsg_internal("oldest unfrozen transaction ID: %u, in database %u",
checkPoint.oldestXid, checkPoint.oldestXidDB))); checkPoint.oldestXid, checkPoint.oldestXidDB)));
ereport(DEBUG1, ereport(DEBUG1,
(errmsg("oldest MultiXactId: %u, in database %u", (errmsg_internal("oldest MultiXactId: %u, in database %u",
checkPoint.oldestMulti, checkPoint.oldestMultiDB))); checkPoint.oldestMulti, checkPoint.oldestMultiDB)));
ereport(DEBUG1, ereport(DEBUG1,
(errmsg("commit timestamp Xid oldest/newest: %u/%u", (errmsg_internal("commit timestamp Xid oldest/newest: %u/%u",
checkPoint.oldestCommitTs, checkPoint.oldestCommitTs,
checkPoint.newestCommitTs))); checkPoint.newestCommitTs)));
if (!TransactionIdIsNormal(checkPoint.nextXid)) if (!TransactionIdIsNormal(checkPoint.nextXid))

View File

@ -1652,7 +1652,7 @@ get_object_address_usermapping(List *objname, List *objargs, bool missing_ok)
if (!missing_ok) if (!missing_ok)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("user mapping for user \"%s\" in server \"%s\" does not exist", errmsg("user mapping for user \"%s\" on server \"%s\" does not exist",
username, servername))); username, servername)));
return address; return address;
} }
@ -1678,7 +1678,7 @@ get_object_address_usermapping(List *objname, List *objargs, bool missing_ok)
if (!missing_ok) if (!missing_ok)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("user mapping for user \"%s\" in server \"%s\" does not exist", errmsg("user mapping for user \"%s\" on server \"%s\" does not exist",
username, servername))); username, servername)));
return address; return address;
} }

View File

@ -877,7 +877,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed)
if (is_from) if (is_from)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("COPY FROM not supported with row level security."), errmsg("COPY FROM not supported with row-level security."),
errhint("Use INSERT statements instead."))); errhint("Use INSERT statements instead.")));
/* Build target list */ /* Build target list */

View File

@ -3028,7 +3028,7 @@ read_whole_file(const char *filename, int *length)
if (fst.st_size > (MaxAllocSize - 1)) if (fst.st_size > (MaxAllocSize - 1))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("file too large"))); errmsg("file \"%s\" is too large", filename)));
bytes_to_read = (size_t) fst.st_size; bytes_to_read = (size_t) fst.st_size;
if ((file = AllocateFile(filename, PG_BINARY_R)) == NULL) if ((file = AllocateFile(filename, PG_BINARY_R)) == NULL)

View File

@ -11195,9 +11195,7 @@ ATPrepChangePersistence(Relation rel, bool toLogged)
case RELPERSISTENCE_TEMP: case RELPERSISTENCE_TEMP:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION), (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("cannot change logged status of table %s", errmsg("cannot change logged status of table \"%s\" because it is temporary",
RelationGetRelationName(rel)),
errdetail("Table %s is temporary.",
RelationGetRelationName(rel)), RelationGetRelationName(rel)),
errtable(rel))); errtable(rel)));
break; break;
@ -11256,9 +11254,7 @@ ATPrepChangePersistence(Relation rel, bool toLogged)
if (foreignrel->rd_rel->relpersistence != RELPERSISTENCE_PERMANENT) if (foreignrel->rd_rel->relpersistence != RELPERSISTENCE_PERMANENT)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION), (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("cannot change status of table %s to logged", errmsg("could not change table \"%s\" to logged because it references unlogged table \"%s\"",
RelationGetRelationName(rel)),
errdetail("Table %s references unlogged table %s.",
RelationGetRelationName(rel), RelationGetRelationName(rel),
RelationGetRelationName(foreignrel)), RelationGetRelationName(foreignrel)),
errtableconstraint(rel, NameStr(con->conname)))); errtableconstraint(rel, NameStr(con->conname))));
@ -11268,11 +11264,9 @@ ATPrepChangePersistence(Relation rel, bool toLogged)
if (foreignrel->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT) if (foreignrel->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION), (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("cannot change status of table %s to unlogged", errmsg("could not change table \"%s\" to unlogged because it references logged table \"%s\"",
RelationGetRelationName(rel)), RelationGetRelationName(rel),
errdetail("Logged table %s is referenced by table %s.", RelationGetRelationName(foreignrel)),
RelationGetRelationName(foreignrel),
RelationGetRelationName(rel)),
errtableconstraint(rel, NameStr(con->conname)))); errtableconstraint(rel, NameStr(con->conname))));
} }

View File

@ -800,7 +800,7 @@ remove_symlink:
/* Refuse to remove anything that's not a directory or symlink */ /* Refuse to remove anything that's not a directory or symlink */
ereport(redo ? LOG : ERROR, ereport(redo ? LOG : ERROR,
(ERRCODE_SYSTEM_ERROR, (ERRCODE_SYSTEM_ERROR,
errmsg("not a directory or symbolic link: \"%s\"", errmsg("\"%s\" is not a directory or symbolic link",
linkloc))); linkloc)));
} }
@ -886,7 +886,7 @@ remove_tablespace_symlink(const char *linkloc)
{ {
/* Refuse to remove anything that's not a directory or symlink */ /* Refuse to remove anything that's not a directory or symlink */
ereport(ERROR, ereport(ERROR,
(errmsg("not a directory or symbolic link: \"%s\"", (errmsg("\"%s\" is not a directory or symbolic link",
linkloc))); linkloc)));
} }
} }

View File

@ -668,8 +668,7 @@ recv_password_packet(Port *port)
errmsg("invalid password packet size"))); errmsg("invalid password packet size")));
/* Do not echo password to logs, for security. */ /* Do not echo password to logs, for security. */
ereport(DEBUG5, elog(DEBUG5, "received password packet");
(errmsg("received password packet")));
/* /*
* Return the received string. Note we do not attempt to do any * Return the received string. Note we do not attempt to do any

View File

@ -1136,7 +1136,7 @@ pq_startmsgread(void)
if (PqCommReadingMsg) if (PqCommReadingMsg)
ereport(FATAL, ereport(FATAL,
(errcode(ERRCODE_PROTOCOL_VIOLATION), (errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("terminating connection because protocol sync was lost"))); errmsg("terminating connection because protocol synchronization was lost")));
PqCommReadingMsg = true; PqCommReadingMsg = true;
} }

View File

@ -979,7 +979,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
if (!gsets) if (!gsets)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_STATEMENT_TOO_COMPLEX), (errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
errmsg("too many grouping sets present (max 4096)"), errmsg("too many grouping sets present (maximum 4096)"),
parser_errposition(pstate, parser_errposition(pstate,
qry->groupClause qry->groupClause
? exprLocation((Node *) qry->groupClause) ? exprLocation((Node *) qry->groupClause)

View File

@ -2856,7 +2856,7 @@ transformOnConflictArbiter(ParseState *pstate,
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("ON CONFLICT DO UPDATE requires inference specification or constraint name"), errmsg("ON CONFLICT DO UPDATE requires inference specification or constraint name"),
errhint("For example, ON CONFLICT (<column>)."), errhint("For example, ON CONFLICT (column_name)."),
parser_errposition(pstate, parser_errposition(pstate,
exprLocation((Node *) onConflictClause)))); exprLocation((Node *) onConflictClause))));

View File

@ -3080,7 +3080,7 @@ errorMissingColumn(ParseState *pstate,
errmsg("column %s.%s does not exist", relname, colname) : errmsg("column %s.%s does not exist", relname, colname) :
errmsg("column \"%s\" does not exist", colname), errmsg("column \"%s\" does not exist", colname),
state->rfirst ? closestfirst ? state->rfirst ? closestfirst ?
errhint("Perhaps you meant to reference the column \"%s\".\"%s\".", errhint("Perhaps you meant to reference the column \"%s.%s\".",
state->rfirst->eref->aliasname, closestfirst) : state->rfirst->eref->aliasname, closestfirst) :
errhint("There is a column named \"%s\" in table \"%s\", but it cannot be referenced from this part of the query.", errhint("There is a column named \"%s\" in table \"%s\", but it cannot be referenced from this part of the query.",
colname, state->rfirst->eref->aliasname) : 0, colname, state->rfirst->eref->aliasname) : 0,
@ -3099,7 +3099,7 @@ errorMissingColumn(ParseState *pstate,
relname ? relname ?
errmsg("column %s.%s does not exist", relname, colname) : errmsg("column %s.%s does not exist", relname, colname) :
errmsg("column \"%s\" does not exist", colname), errmsg("column \"%s\" does not exist", colname),
errhint("Perhaps you meant to reference the column \"%s\".\"%s\" or the column \"%s\".\"%s\".", errhint("Perhaps you meant to reference the column \"%s.%s\" or the column \"%s.%s\".",
state->rfirst->eref->aliasname, closestfirst, state->rfirst->eref->aliasname, closestfirst,
state->rsecond->eref->aliasname, closestsecond), state->rsecond->eref->aliasname, closestsecond),
parser_errposition(pstate, location))); parser_errposition(pstate, location)));

View File

@ -2047,8 +2047,10 @@ retry1:
else if (!parse_bool(valptr, &am_walsender)) else if (!parse_bool(valptr, &am_walsender))
ereport(FATAL, ereport(FATAL,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid value for parameter \"replication\""), errmsg("invalid value for parameter \"%s\": \"%s\"",
errhint("Valid values are: false, 0, true, 1, database."))); "replication",
valptr),
errhint("Valid values are: \"false\", 0, \"true\", 1, \"database\".")));
} }
else else
{ {

View File

@ -187,7 +187,7 @@ PRINT_LWDEBUG(const char *where, LWLock *lock, LWLockMode mode)
ereport(LOG, ereport(LOG,
(errhidestmt(true), (errhidestmt(true),
errhidecontext(true), errhidecontext(true),
errmsg("%d: %s(%s %d): excl %u shared %u haswaiters %u waiters %u rOK %d", errmsg_internal("%d: %s(%s %d): excl %u shared %u haswaiters %u waiters %u rOK %d",
MyProcPid, MyProcPid,
where, T_NAME(lock), T_ID(lock), where, T_NAME(lock), T_ID(lock),
!!(state & LW_VAL_EXCLUSIVE), !!(state & LW_VAL_EXCLUSIVE),
@ -207,7 +207,7 @@ LOG_LWDEBUG(const char *where, LWLock *lock, const char *msg)
ereport(LOG, ereport(LOG,
(errhidestmt(true), (errhidestmt(true),
errhidecontext(true), errhidecontext(true),
errmsg("%s(%s %d): %s", where, errmsg_internal("%s(%s %d): %s", where,
T_NAME(lock), T_ID(lock), msg))); T_NAME(lock), T_ID(lock), msg)));
} }
} }

View File

@ -746,7 +746,7 @@ array_position_common(FunctionCallInfo fcinfo)
if (PG_ARGISNULL(2)) if (PG_ARGISNULL(2))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("initial position should not be NULL"))); errmsg("initial position must not be null")));
position_min = PG_GETARG_INT32(2); position_min = PG_GETARG_INT32(2);
} }

View File

@ -304,7 +304,7 @@ b64_decode(const char *src, unsigned len, char *dst)
if (b < 0) if (b < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid symbol '%c' while decoding base64 sequence", (int) c))); errmsg("invalid symbol \"%c\" while decoding base64 sequence", (int) c)));
} }
/* add it to buffer */ /* add it to buffer */
buf = (buf << 6) + b; buf = (buf << 6) + b;
@ -325,7 +325,7 @@ b64_decode(const char *src, unsigned len, char *dst)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid base64 end sequence"), errmsg("invalid base64 end sequence"),
errhint("Input data is missing padding, truncated, or otherwise corrupted."))); errhint("Input data is missing padding, is truncated, or is otherwise corrupted.")));
return p - dst; return p - dst;
} }

View File

@ -1179,7 +1179,7 @@ jsonb_build_object(PG_FUNCTION_ARGS)
if (nargs % 2 != 0) if (nargs % 2 != 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid number or arguments: object must be matched key value pairs"))); errmsg("invalid number of arguments: object must be matched key value pairs")));
memset(&result, 0, sizeof(JsonbInState)); memset(&result, 0, sizeof(JsonbInState));
@ -1193,7 +1193,7 @@ jsonb_build_object(PG_FUNCTION_ARGS)
if (PG_ARGISNULL(i)) if (PG_ARGISNULL(i))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("arg %d: key cannot be null", i + 1))); errmsg("argument %d: key must not be null", i + 1)));
val_type = get_fn_expr_argtype(fcinfo->flinfo, i); val_type = get_fn_expr_argtype(fcinfo->flinfo, i);
/* /*
@ -1215,7 +1215,7 @@ jsonb_build_object(PG_FUNCTION_ARGS)
if (val_type == InvalidOid || val_type == UNKNOWNOID) if (val_type == InvalidOid || val_type == UNKNOWNOID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("arg %d: could not determine data type", i + 1))); errmsg("argument %d: could not determine data type", i + 1)));
add_jsonb(arg, false, &result, val_type, true); add_jsonb(arg, false, &result, val_type, true);

View File

@ -2462,7 +2462,7 @@ static struct config_int ConfigureNamesInt[] =
{ {
{"wal_retrieve_retry_interval", PGC_SIGHUP, REPLICATION_STANDBY, {"wal_retrieve_retry_interval", PGC_SIGHUP, REPLICATION_STANDBY,
gettext_noop("Sets the time to wait before retrying to retrieve WAL" gettext_noop("Sets the time to wait before retrying to retrieve WAL "
"after a failed attempt."), "after a failed attempt."),
NULL, NULL,
GUC_UNIT_MS GUC_UNIT_MS
@ -2580,7 +2580,7 @@ static struct config_int ConfigureNamesInt[] =
{ {
{"ssl_renegotiation_limit", PGC_USERSET, CONN_AUTH_SECURITY, {"ssl_renegotiation_limit", PGC_USERSET, CONN_AUTH_SECURITY,
gettext_noop("SSL regenotiation is no longer supported; this can only be 0"), gettext_noop("SSL regenotiation is no longer supported; this can only be 0."),
NULL, NULL,
GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE, GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE,
}, },
@ -3388,7 +3388,7 @@ static struct config_string ConfigureNamesString[] =
{ {
{"cluster_name", PGC_POSTMASTER, PROCESS_TITLE, {"cluster_name", PGC_POSTMASTER, PROCESS_TITLE,
gettext_noop("Sets the name of the cluster which is included in the process title."), gettext_noop("Sets the name of the cluster, which is included in the process title."),
NULL, NULL,
GUC_IS_NAME GUC_IS_NAME
}, },

View File

@ -122,7 +122,7 @@ check_enable_rls(Oid relid, Oid checkAsUser, bool noError)
if (!row_security && !noError) if (!row_security && !noError)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("insufficient privilege to bypass row security."))); errmsg("insufficient privilege to bypass row-level security")));
/* RLS should be fully enabled for this relation. */ /* RLS should be fully enabled for this relation. */
return RLS_ENABLED; return RLS_ENABLED;

View File

@ -186,7 +186,7 @@ _dosmaperr(unsigned long e)
(errmsg_internal("mapped win32 error code %lu to %d", (errmsg_internal("mapped win32 error code %lu to %d",
e, doserr))); e, doserr)));
#elif FRONTEND_DEBUG #elif FRONTEND_DEBUG
fprintf(stderr, _("mapped win32 error code %lu to %d"), e, doserr); fprintf(stderr, "mapped win32 error code %lu to %d", e, doserr);
#endif #endif
errno = doserr; errno = doserr;
return; return;
@ -198,7 +198,7 @@ _dosmaperr(unsigned long e)
(errmsg_internal("unrecognized win32 error code: %lu", (errmsg_internal("unrecognized win32 error code: %lu",
e))); e)));
#else #else
fprintf(stderr, _("unrecognized win32 error code: %lu"), e); fprintf(stderr, "unrecognized win32 error code: %lu", e);
#endif #endif
errno = EINVAL; errno = EINVAL;

View File

@ -551,7 +551,7 @@ create table atacc1 ( test int );
-- add a check constraint (fails) -- add a check constraint (fails)
alter table atacc1 add constraint atacc_test1 check (test1>3); alter table atacc1 add constraint atacc_test1 check (test1>3);
ERROR: column "test1" does not exist ERROR: column "test1" does not exist
HINT: Perhaps you meant to reference the column "atacc1"."test". HINT: Perhaps you meant to reference the column "atacc1.test".
drop table atacc1; drop table atacc1;
-- something a little more complicated -- something a little more complicated
create table atacc1 ( test int, test2 int, test3 int); create table atacc1 ( test int, test2 int, test3 int);
@ -1358,7 +1358,7 @@ select f1 from c1;
ERROR: column "f1" does not exist ERROR: column "f1" does not exist
LINE 1: select f1 from c1; LINE 1: select f1 from c1;
^ ^
HINT: Perhaps you meant to reference the column "c1"."f2". HINT: Perhaps you meant to reference the column "c1.f2".
drop table p1 cascade; drop table p1 cascade;
NOTICE: drop cascades to table c1 NOTICE: drop cascades to table c1
create table p1 (f1 int, f2 int); create table p1 (f1 int, f2 int);
@ -1372,7 +1372,7 @@ select f1 from c1;
ERROR: column "f1" does not exist ERROR: column "f1" does not exist
LINE 1: select f1 from c1; LINE 1: select f1 from c1;
^ ^
HINT: Perhaps you meant to reference the column "c1"."f2". HINT: Perhaps you meant to reference the column "c1.f2".
drop table p1 cascade; drop table p1 cascade;
NOTICE: drop cascades to table c1 NOTICE: drop cascades to table c1
create table p1 (f1 int, f2 int); create table p1 (f1 int, f2 int);
@ -2550,8 +2550,7 @@ CREATE UNLOGGED TABLE unlogged2(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unl
CREATE UNLOGGED TABLE unlogged3(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unlogged3); -- self-referencing foreign key CREATE UNLOGGED TABLE unlogged3(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unlogged3); -- self-referencing foreign key
ALTER TABLE unlogged3 SET LOGGED; -- skip self-referencing foreign key ALTER TABLE unlogged3 SET LOGGED; -- skip self-referencing foreign key
ALTER TABLE unlogged2 SET LOGGED; -- fails because a foreign key to an unlogged table exists ALTER TABLE unlogged2 SET LOGGED; -- fails because a foreign key to an unlogged table exists
ERROR: cannot change status of table unlogged2 to logged ERROR: could not change table "unlogged2" to logged because it references unlogged table "unlogged1"
DETAIL: Table unlogged2 references unlogged table unlogged1.
ALTER TABLE unlogged1 SET LOGGED; ALTER TABLE unlogged1 SET LOGGED;
-- check relpersistence of an unlogged table after changing to permament -- check relpersistence of an unlogged table after changing to permament
SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged1' SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged1'
@ -2594,8 +2593,7 @@ ORDER BY relname;
CREATE TABLE logged2(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES logged1); -- foreign key CREATE TABLE logged2(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES logged1); -- foreign key
CREATE TABLE logged3(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES logged3); -- self-referencing foreign key CREATE TABLE logged3(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES logged3); -- self-referencing foreign key
ALTER TABLE logged1 SET UNLOGGED; -- fails because a foreign key from a permanent table exists ALTER TABLE logged1 SET UNLOGGED; -- fails because a foreign key from a permanent table exists
ERROR: cannot change status of table logged1 to unlogged ERROR: could not change table "logged1" to unlogged because it references logged table "logged2"
DETAIL: Logged table logged2 is referenced by table logged1.
ALTER TABLE logged3 SET UNLOGGED; -- skip self-referencing foreign key ALTER TABLE logged3 SET UNLOGGED; -- skip self-referencing foreign key
ALTER TABLE logged2 SET UNLOGGED; ALTER TABLE logged2 SET UNLOGGED;
ALTER TABLE logged1 SET UNLOGGED; ALTER TABLE logged1 SET UNLOGGED;

View File

@ -226,7 +226,7 @@ insert into insertconflicttest values (1, 'Apple') on conflict do update set fru
ERROR: ON CONFLICT DO UPDATE requires inference specification or constraint name ERROR: ON CONFLICT DO UPDATE requires inference specification or constraint name
LINE 1: ...nsert into insertconflicttest values (1, 'Apple') on conflic... LINE 1: ...nsert into insertconflicttest values (1, 'Apple') on conflic...
^ ^
HINT: For example, ON CONFLICT (<column>). HINT: For example, ON CONFLICT (column_name).
-- inference succeeds: -- inference succeeds:
insert into insertconflicttest values (1, 'Apple') on conflict (key) do update set fruit = excluded.fruit; insert into insertconflicttest values (1, 'Apple') on conflict (key) do update set fruit = excluded.fruit;
insert into insertconflicttest values (2, 'Orange') on conflict (key, key, key) do update set fruit = excluded.fruit; insert into insertconflicttest values (2, 'Orange') on conflict (key, key, key) do update set fruit = excluded.fruit;
@ -246,13 +246,13 @@ insert into insertconflicttest values (1, 'Apple') on conflict (keyy) do update
ERROR: column "keyy" does not exist ERROR: column "keyy" does not exist
LINE 1: ...nsertconflicttest values (1, 'Apple') on conflict (keyy) do ... LINE 1: ...nsertconflicttest values (1, 'Apple') on conflict (keyy) do ...
^ ^
HINT: Perhaps you meant to reference the column "insertconflicttest"."key". HINT: Perhaps you meant to reference the column "insertconflicttest.key".
-- Have useful HINT for EXCLUDED.* RTE within UPDATE: -- Have useful HINT for EXCLUDED.* RTE within UPDATE:
insert into insertconflicttest values (1, 'Apple') on conflict (key) do update set fruit = excluded.fruitt; insert into insertconflicttest values (1, 'Apple') on conflict (key) do update set fruit = excluded.fruitt;
ERROR: column excluded.fruitt does not exist ERROR: column excluded.fruitt does not exist
LINE 1: ... 'Apple') on conflict (key) do update set fruit = excluded.f... LINE 1: ... 'Apple') on conflict (key) do update set fruit = excluded.f...
^ ^
HINT: Perhaps you meant to reference the column "excluded"."fruit". HINT: Perhaps you meant to reference the column "excluded.fruit".
-- inference fails: -- inference fails:
insert into insertconflicttest values (3, 'Kiwi') on conflict (key, fruit) do update set fruit = excluded.fruit; insert into insertconflicttest values (3, 'Kiwi') on conflict (key, fruit) do update set fruit = excluded.fruit;
ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification

View File

@ -2299,7 +2299,7 @@ select t1.x from t1 join t3 on (t1.a = t3.x);
ERROR: column t1.x does not exist ERROR: column t1.x does not exist
LINE 1: select t1.x from t1 join t3 on (t1.a = t3.x); LINE 1: select t1.x from t1 join t3 on (t1.a = t3.x);
^ ^
HINT: Perhaps you meant to reference the column "t3"."x". HINT: Perhaps you meant to reference the column "t3.x".
-- --
-- regression test for 8.1 merge right join bug -- regression test for 8.1 merge right join bug
-- --
@ -3982,19 +3982,19 @@ select t1.uunique1 from
ERROR: column t1.uunique1 does not exist ERROR: column t1.uunique1 does not exist
LINE 1: select t1.uunique1 from LINE 1: select t1.uunique1 from
^ ^
HINT: Perhaps you meant to reference the column "t1"."unique1". HINT: Perhaps you meant to reference the column "t1.unique1".
select t2.uunique1 from select t2.uunique1 from
tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, prefer "t2" suggestion tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, prefer "t2" suggestion
ERROR: column t2.uunique1 does not exist ERROR: column t2.uunique1 does not exist
LINE 1: select t2.uunique1 from LINE 1: select t2.uunique1 from
^ ^
HINT: Perhaps you meant to reference the column "t2"."unique1". HINT: Perhaps you meant to reference the column "t2.unique1".
select uunique1 from select uunique1 from
tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, suggest both at once tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, suggest both at once
ERROR: column "uunique1" does not exist ERROR: column "uunique1" does not exist
LINE 1: select uunique1 from LINE 1: select uunique1 from
^ ^
HINT: Perhaps you meant to reference the column "t1"."unique1" or the column "t2"."unique1". HINT: Perhaps you meant to reference the column "t1.unique1" or the column "t2.unique1".
-- --
-- Take care to reference the correct RTE -- Take care to reference the correct RTE
-- --

View File

@ -1373,7 +1373,7 @@ SELECT jsonb_build_object(1,2);
-- keys must be scalar and not null -- keys must be scalar and not null
SELECT jsonb_build_object(null,2); SELECT jsonb_build_object(null,2);
ERROR: arg 1: key cannot be null ERROR: argument 1: key must not be null
SELECT jsonb_build_object(r,2) FROM (SELECT 1 AS a, 2 AS b) r; SELECT jsonb_build_object(r,2) FROM (SELECT 1 AS a, 2 AS b) r;
ERROR: key value must be scalar, not array, composite, or json ERROR: key value must be scalar, not array, composite, or json
SELECT jsonb_build_object(json '{"a":1,"b":2}', 3); SELECT jsonb_build_object(json '{"a":1,"b":2}', 3);

View File

@ -253,11 +253,11 @@ WARNING: error for policy,{addr_nsp,zwei},{integer}: relation "addr_nsp" does n
WARNING: error for policy,{eins,zwei,drei},{}: schema "eins" does not exist WARNING: error for policy,{eins,zwei,drei},{}: schema "eins" does not exist
WARNING: error for policy,{eins,zwei,drei},{integer}: schema "eins" does not exist WARNING: error for policy,{eins,zwei,drei},{integer}: schema "eins" does not exist
WARNING: error for user mapping,{eins},{}: argument list length must be exactly 1 WARNING: error for user mapping,{eins},{}: argument list length must be exactly 1
WARNING: error for user mapping,{eins},{integer}: user mapping for user "eins" in server "integer" does not exist WARNING: error for user mapping,{eins},{integer}: user mapping for user "eins" on server "integer" does not exist
WARNING: error for user mapping,{addr_nsp,zwei},{}: argument list length must be exactly 1 WARNING: error for user mapping,{addr_nsp,zwei},{}: argument list length must be exactly 1
WARNING: error for user mapping,{addr_nsp,zwei},{integer}: user mapping for user "addr_nsp" in server "integer" does not exist WARNING: error for user mapping,{addr_nsp,zwei},{integer}: user mapping for user "addr_nsp" on server "integer" does not exist
WARNING: error for user mapping,{eins,zwei,drei},{}: argument list length must be exactly 1 WARNING: error for user mapping,{eins,zwei,drei},{}: argument list length must be exactly 1
WARNING: error for user mapping,{eins,zwei,drei},{integer}: user mapping for user "eins" in server "integer" does not exist WARNING: error for user mapping,{eins,zwei,drei},{integer}: user mapping for user "eins" on server "integer" does not exist
WARNING: error for default acl,{eins},{}: argument list length must be exactly 1 WARNING: error for default acl,{eins},{}: argument list length must be exactly 1
WARNING: error for default acl,{eins},{integer}: unrecognized default ACL object type i WARNING: error for default acl,{eins},{integer}: unrecognized default ACL object type i
WARNING: error for default acl,{addr_nsp,zwei},{}: argument list length must be exactly 1 WARNING: error for default acl,{addr_nsp,zwei},{}: argument list length must be exactly 1

View File

@ -2577,7 +2577,7 @@ COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ',';
SET SESSION AUTHORIZATION rls_regress_user1; SET SESSION AUTHORIZATION rls_regress_user1;
SET row_security TO OFF; SET row_security TO OFF;
COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - insufficient to bypass rls COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - insufficient to bypass rls
ERROR: insufficient privilege to bypass row security. ERROR: insufficient privilege to bypass row-level security
SET row_security TO ON; SET row_security TO ON;
COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --ok COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --ok
0,cfcd208495d565ef66e7dff9f98764da 0,cfcd208495d565ef66e7dff9f98764da
@ -2618,7 +2618,7 @@ COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --ok
SET SESSION AUTHORIZATION rls_regress_user2; SET SESSION AUTHORIZATION rls_regress_user2;
SET row_security TO OFF; SET row_security TO OFF;
COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - insufficient to bypass rls COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - insufficient to bypass rls
ERROR: insufficient privilege to bypass row security. ERROR: insufficient privilege to bypass row-level security
SET row_security TO ON; SET row_security TO ON;
COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - permission denied COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - permission denied
ERROR: permission denied for relation copy_t ERROR: permission denied for relation copy_t
@ -2642,7 +2642,7 @@ COPY copy_rel_to TO STDOUT WITH DELIMITER ',';
SET SESSION AUTHORIZATION rls_regress_user1; SET SESSION AUTHORIZATION rls_regress_user1;
SET row_security TO OFF; SET row_security TO OFF;
COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --fail - insufficient to bypass rls COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --fail - insufficient to bypass rls
ERROR: insufficient privilege to bypass row security. ERROR: insufficient privilege to bypass row-level security
SET row_security TO ON; SET row_security TO ON;
COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --ok COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --ok
-- Check COPY TO as user with permissions and BYPASSRLS -- Check COPY TO as user with permissions and BYPASSRLS
@ -2671,10 +2671,10 @@ COPY copy_t FROM STDIN; --ok
SET SESSION AUTHORIZATION rls_regress_user1; SET SESSION AUTHORIZATION rls_regress_user1;
SET row_security TO OFF; SET row_security TO OFF;
COPY copy_t FROM STDIN; --fail - insufficient privilege to bypass rls. COPY copy_t FROM STDIN; --fail - insufficient privilege to bypass rls.
ERROR: insufficient privilege to bypass row security. ERROR: insufficient privilege to bypass row-level security
SET row_security TO ON; SET row_security TO ON;
COPY copy_t FROM STDIN; --fail - COPY FROM not supported by RLS. COPY copy_t FROM STDIN; --fail - COPY FROM not supported by RLS.
ERROR: COPY FROM not supported with row level security. ERROR: COPY FROM not supported with row-level security.
HINT: Use INSERT statements instead. HINT: Use INSERT statements instead.
-- Check COPY FROM as user with permissions and BYPASSRLS -- Check COPY FROM as user with permissions and BYPASSRLS
SET SESSION AUTHORIZATION rls_regress_exempt_user; SET SESSION AUTHORIZATION rls_regress_exempt_user;