Commit a8d585c0 authored by Peter Eisentraut's avatar Peter Eisentraut

Message style improvements

Message style, plurals, quoting, spelling, consistency with similar
messages
parent d4556516
...@@ -14,7 +14,7 @@ SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'for ...@@ -14,7 +14,7 @@ SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'for
-- fails, binary plugin, textual consumer -- fails, binary plugin, textual consumer
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'force-binary', '1', 'skip-empty-xacts', '1'); SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'force-binary', '1', 'skip-empty-xacts', '1');
ERROR: logical decoding output plugin "test_decoding" produces binary output, but "pg_logical_slot_get_changes(name,pg_lsn,integer,text[])" expects textual data ERROR: logical decoding output plugin "test_decoding" produces binary output, but function "pg_logical_slot_get_changes(name,pg_lsn,integer,text[])" expects textual data
-- succeeds, textual plugin, binary consumer -- succeeds, textual plugin, binary consumer
SELECT data FROM pg_logical_slot_get_binary_changes('regression_slot', NULL, NULL, 'force-binary', '0', 'skip-empty-xacts', '1'); SELECT data FROM pg_logical_slot_get_binary_changes('regression_slot', NULL, NULL, 'force-binary', '0', 'skip-empty-xacts', '1');
data data
......
...@@ -1140,7 +1140,9 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset) ...@@ -1140,7 +1140,9 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
nmembers + MULTIXACT_MEMBERS_PER_PAGE * SLRU_PAGES_PER_SEGMENT * OFFSET_WARN_SEGMENTS)) nmembers + MULTIXACT_MEMBERS_PER_PAGE * SLRU_PAGES_PER_SEGMENT * OFFSET_WARN_SEGMENTS))
ereport(WARNING, ereport(WARNING,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("database with OID %u must be vacuumed before %d more multixact members are used", errmsg_plural("database with OID %u must be vacuumed before %d more multixact member is used",
"database with OID %u must be vacuumed before %d more multixact members are used",
MultiXactState->offsetStopLimit - nextOffset + nmembers,
MultiXactState->oldestMultiXactDB, MultiXactState->oldestMultiXactDB,
MultiXactState->offsetStopLimit - nextOffset + nmembers), MultiXactState->offsetStopLimit - nextOffset + nmembers),
errhint("Execute a database-wide VACUUM in that database with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings."))); errhint("Execute a database-wide VACUUM in that database with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings.")));
......
...@@ -1619,7 +1619,7 @@ find_expr_references_walker(Node *node, ...@@ -1619,7 +1619,7 @@ find_expr_references_walker(Node *node,
case REGROLEOID: case REGROLEOID:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("constant of the type \'regrole\' cannot be used here"))); errmsg("constant of the type \"regrole\" cannot be used here")));
break; break;
} }
} }
......
...@@ -1740,7 +1740,7 @@ get_object_address_defacl(List *objname, List *objargs, bool missing_ok) ...@@ -1740,7 +1740,7 @@ get_object_address_defacl(List *objname, List *objargs, bool missing_ok)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unrecognized default ACL object type %c", objtype), errmsg("unrecognized default ACL object type %c", objtype),
errhint("Valid object types are 'r', 'S', 'f', and 'T'."))); errhint("Valid object types are \"r\", \"S\", \"f\", and \"T\".")));
} }
/* /*
......
...@@ -875,7 +875,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed) ...@@ -875,7 +875,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed)
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 direct INSERT statements instead."))); errhint("Use INSERT statements instead.")));
/* Build target list */ /* Build target list */
cr = makeNode(ColumnRef); cr = makeNode(ColumnRef);
......
...@@ -608,7 +608,7 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner, ...@@ -608,7 +608,7 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner,
*/ */
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_CARDINALITY_VIOLATION), (errcode(ERRCODE_CARDINALITY_VIOLATION),
errmsg("new data for \"%s\" contains duplicate rows without any null columns", errmsg("new data for materialized view \"%s\" contains duplicate rows without any null columns",
RelationGetRelationName(matviewRel)), RelationGetRelationName(matviewRel)),
errdetail("Row: %s", errdetail("Row: %s",
SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1)))); SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1))));
......
...@@ -9811,7 +9811,7 @@ AlterTableMoveAll(AlterTableMoveAllStmt *stmt) ...@@ -9811,7 +9811,7 @@ AlterTableMoveAll(AlterTableMoveAllStmt *stmt)
!ConditionalLockRelationOid(relOid, AccessExclusiveLock)) !ConditionalLockRelationOid(relOid, AccessExclusiveLock))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE), (errcode(ERRCODE_OBJECT_IN_USE),
errmsg("aborting because lock on relation \"%s\".\"%s\" is not available", errmsg("aborting because lock on relation \"%s.%s\" is not available",
get_namespace_name(relForm->relnamespace), get_namespace_name(relForm->relnamespace),
NameStr(relForm->relname)))); NameStr(relForm->relname))));
else else
......
...@@ -857,7 +857,7 @@ remove_tablespace_symlink(const char *linkloc) ...@@ -857,7 +857,7 @@ remove_tablespace_symlink(const char *linkloc)
return; return;
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not stat \"%s\": %m", linkloc))); errmsg("could not stat file \"%s\": %m", linkloc)));
} }
if (S_ISDIR(st.st_mode)) if (S_ISDIR(st.st_mode))
......
...@@ -1124,9 +1124,13 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, ...@@ -1124,9 +1124,13 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
nkeep); nkeep);
appendStringInfo(&buf, _("There were %.0f unused item pointers.\n"), appendStringInfo(&buf, _("There were %.0f unused item pointers.\n"),
nunused); nunused);
appendStringInfo(&buf, _("Skipped %u pages due to buffer pins.\n"), appendStringInfo(&buf, ngettext("Skipped %u page due to buffer pins.\n",
"Skipped %u pages due to buffer pins.\n",
vacrelstats->pinskipped_pages),
vacrelstats->pinskipped_pages); vacrelstats->pinskipped_pages);
appendStringInfo(&buf, _("%u pages are entirely empty.\n"), appendStringInfo(&buf, ngettext("%u page is entirely empty.\n",
"%u pages are entirely empty.\n",
empty_pages),
empty_pages); empty_pages);
appendStringInfo(&buf, _("%s."), appendStringInfo(&buf, _("%s."),
pg_rusage_show(&ru0)); pg_rusage_show(&ru0));
......
...@@ -1832,7 +1832,7 @@ ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, ...@@ -1832,7 +1832,7 @@ ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo,
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_WITH_CHECK_OPTION_VIOLATION), (errcode(ERRCODE_WITH_CHECK_OPTION_VIOLATION),
errmsg("new row violates WITH CHECK OPTION for \"%s\"", errmsg("new row violates check option for view \"%s\"",
wco->relname), wco->relname),
val_desc ? errdetail("Failing row contains %s.", val_desc ? errdetail("Failing row contains %s.",
val_desc) : 0)); val_desc) : 0));
...@@ -1842,24 +1842,24 @@ ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, ...@@ -1842,24 +1842,24 @@ ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo,
if (wco->polname != NULL) if (wco->polname != NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("new row violates row level security policy \"%s\" for \"%s\"", errmsg("new row violates row-level security policy \"%s\" for table \"%s\"",
wco->polname, wco->relname))); wco->polname, wco->relname)));
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("new row violates row level security policy for \"%s\"", errmsg("new row violates row-level security policy for table \"%s\"",
wco->relname))); wco->relname)));
break; break;
case WCO_RLS_CONFLICT_CHECK: case WCO_RLS_CONFLICT_CHECK:
if (wco->polname != NULL) if (wco->polname != NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("new row violates row level security policy \"%s\" (USING expression) for \"%s\"", errmsg("new row violates row-level security policy \"%s\" (USING expression) for table \"%s\"",
wco->polname, wco->relname))); wco->polname, wco->relname)));
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("new row violates row level security policy (USING expression) for \"%s\"", errmsg("new row violates row-level security policy (USING expression) for table \"%s\"",
wco->relname))); wco->relname)));
break; break;
default: default:
......
...@@ -2867,7 +2867,7 @@ transformOnConflictArbiter(ParseState *pstate, ...@@ -2867,7 +2867,7 @@ transformOnConflictArbiter(ParseState *pstate,
if (IsCatalogRelation(pstate->p_target_relation)) if (IsCatalogRelation(pstate->p_target_relation))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("ON CONFLICT not supported with system catalog tables"), errmsg("ON CONFLICT is not supported with system catalog tables"),
parser_errposition(pstate, parser_errposition(pstate,
exprLocation((Node *) onConflictClause)))); exprLocation((Node *) onConflictClause))));
...@@ -2875,7 +2875,7 @@ transformOnConflictArbiter(ParseState *pstate, ...@@ -2875,7 +2875,7 @@ transformOnConflictArbiter(ParseState *pstate,
if (RelationIsUsedAsCatalogTable(pstate->p_target_relation)) if (RelationIsUsedAsCatalogTable(pstate->p_target_relation))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("ON CONFLICT not supported on table \"%s\" used as a catalog table", errmsg("ON CONFLICT is not supported on table \"%s\" used as a catalog table",
RelationGetRelationName(pstate->p_target_relation)), RelationGetRelationName(pstate->p_target_relation)),
parser_errposition(pstate, parser_errposition(pstate,
exprLocation((Node *) onConflictClause)))); exprLocation((Node *) onConflictClause))));
......
...@@ -403,7 +403,7 @@ pg_logical_slot_get_changes_guts(FunctionCallInfo fcinfo, bool confirm, bool bin ...@@ -403,7 +403,7 @@ pg_logical_slot_get_changes_guts(FunctionCallInfo fcinfo, bool confirm, bool bin
ctx->options.output_type !=OUTPUT_PLUGIN_TEXTUAL_OUTPUT) ctx->options.output_type !=OUTPUT_PLUGIN_TEXTUAL_OUTPUT)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("logical decoding output plugin \"%s\" produces binary output, but \"%s\" expects textual data", errmsg("logical decoding output plugin \"%s\" produces binary output, but function \"%s\" expects textual data",
NameStr(MyReplicationSlot->data.plugin), NameStr(MyReplicationSlot->data.plugin),
format_procedure(fcinfo->flinfo->fn_oid)))); format_procedure(fcinfo->flinfo->fn_oid))));
......
...@@ -313,7 +313,7 @@ replorigin_create(char *roname) ...@@ -313,7 +313,7 @@ replorigin_create(char *roname)
if (tuple == NULL) if (tuple == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("no free replication origin oid could be found"))); errmsg("could not find free replication origin OID")));
heap_freetuple(tuple); heap_freetuple(tuple);
return roident; return roident;
...@@ -350,7 +350,7 @@ replorigin_drop(RepOriginId roident) ...@@ -350,7 +350,7 @@ replorigin_drop(RepOriginId roident)
{ {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE), (errcode(ERRCODE_OBJECT_IN_USE),
errmsg("cannot drop replication origin with oid %d, in use by pid %d", errmsg("could not drop replication origin with OID %d, in use by PID %d",
state->roident, state->roident,
state->acquired_by))); state->acquired_by)));
} }
...@@ -728,7 +728,7 @@ StartupReplicationOrigin(void) ...@@ -728,7 +728,7 @@ StartupReplicationOrigin(void)
if (last_state == max_replication_slots) if (last_state == max_replication_slots)
ereport(PANIC, ereport(PANIC,
(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED), (errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
errmsg("no free replication state could be found, increase max_replication_slots"))); errmsg("could not find free replication state, increase max_replication_slots")));
/* copy data to shared memory */ /* copy data to shared memory */
replication_states[last_state].roident = disk_state.roident; replication_states[last_state].roident = disk_state.roident;
...@@ -746,7 +746,7 @@ StartupReplicationOrigin(void) ...@@ -746,7 +746,7 @@ StartupReplicationOrigin(void)
if (file_crc != crc) if (file_crc != crc)
ereport(PANIC, ereport(PANIC,
(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED), (errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
errmsg("replication_slot_checkpoint has wrong checksum %u, expected %u", errmsg("replication slot checkpoint has wrong checksum %u, expected %u",
crc, file_crc))); crc, file_crc)));
CloseTransientFile(fd); CloseTransientFile(fd);
...@@ -870,7 +870,7 @@ replorigin_advance(RepOriginId node, ...@@ -870,7 +870,7 @@ replorigin_advance(RepOriginId node,
{ {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE), (errcode(ERRCODE_OBJECT_IN_USE),
errmsg("replication origin with oid %d is already active for pid %d", errmsg("replication origin with OID %d is already active for PID %d",
replication_state->roident, replication_state->roident,
replication_state->acquired_by))); replication_state->acquired_by)));
} }
...@@ -881,7 +881,7 @@ replorigin_advance(RepOriginId node, ...@@ -881,7 +881,7 @@ replorigin_advance(RepOriginId node,
if (replication_state == NULL && free_state == NULL) if (replication_state == NULL && free_state == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED), (errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
errmsg("no free replication state slot could be found for replication origin with oid %u", errmsg("could not find free replication state slot for replication origin with OID %u",
node), node),
errhint("Increase max_replication_slots and try again."))); errhint("Increase max_replication_slots and try again.")));
...@@ -1049,7 +1049,7 @@ replorigin_session_setup(RepOriginId node) ...@@ -1049,7 +1049,7 @@ replorigin_session_setup(RepOriginId node)
{ {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE), (errcode(ERRCODE_OBJECT_IN_USE),
errmsg("replication identifier %d is already active for pid %d", errmsg("replication identifier %d is already active for PID %d",
curstate->roident, curstate->acquired_by))); curstate->roident, curstate->acquired_by)));
} }
...@@ -1061,7 +1061,7 @@ replorigin_session_setup(RepOriginId node) ...@@ -1061,7 +1061,7 @@ replorigin_session_setup(RepOriginId node)
if (session_replication_state == NULL && free_slot == -1) if (session_replication_state == NULL && free_slot == -1)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED), (errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
errmsg("no free replication state slot could be found for replication origin with oid %u", errmsg("could not find free replication state slot for replication origin with OID %u",
node), node),
errhint("Increase max_replication_slots and try again."))); errhint("Increase max_replication_slots and try again.")));
else if (session_replication_state == NULL) else if (session_replication_state == NULL)
......
...@@ -1677,12 +1677,12 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn) ...@@ -1677,12 +1677,12 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
if (ondisk.magic != SNAPBUILD_MAGIC) if (ondisk.magic != SNAPBUILD_MAGIC)
ereport(ERROR, ereport(ERROR,
(errmsg("snapbuild state file \"%s\" has wrong magic %u instead of %u", (errmsg("snapbuild state file \"%s\" has wrong magic number: %u instead of %u",
path, ondisk.magic, SNAPBUILD_MAGIC))); path, ondisk.magic, SNAPBUILD_MAGIC)));
if (ondisk.version != SNAPBUILD_VERSION) if (ondisk.version != SNAPBUILD_VERSION)
ereport(ERROR, ereport(ERROR,
(errmsg("snapbuild state file \"%s\" has unsupported version %u instead of %u", (errmsg("snapbuild state file \"%s\" has unsupported version: %u instead of %u",
path, ondisk.version, SNAPBUILD_VERSION))); path, ondisk.version, SNAPBUILD_VERSION)));
INIT_CRC32C(checksum); INIT_CRC32C(checksum);
...@@ -1738,7 +1738,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn) ...@@ -1738,7 +1738,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
if (!EQ_CRC32C(checksum, ondisk.checksum)) if (!EQ_CRC32C(checksum, ondisk.checksum))
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("snapbuild state file %s: checksum mismatch, is %u, should be %u", errmsg("checksum mismatch for snapbuild state file \"%s\": is %u, should be %u",
path, checksum, ondisk.checksum))); path, checksum, ondisk.checksum)));
/* /*
......
...@@ -344,7 +344,7 @@ ReplicationSlotAcquire(const char *name) ...@@ -344,7 +344,7 @@ ReplicationSlotAcquire(const char *name)
if (active_pid != 0) if (active_pid != 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE), (errcode(ERRCODE_OBJECT_IN_USE),
errmsg("replication slot \"%s\" is already active for pid %d", errmsg("replication slot \"%s\" is already active for PID %d",
name, active_pid))); name, active_pid)));
/* We made this slot active, so it's ours now. */ /* We made this slot active, so it's ours now. */
...@@ -1179,7 +1179,7 @@ RestoreSlotFromDisk(const char *name) ...@@ -1179,7 +1179,7 @@ RestoreSlotFromDisk(const char *name)
if (cp.magic != SLOT_MAGIC) if (cp.magic != SLOT_MAGIC)
ereport(PANIC, ereport(PANIC,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("replication slot file \"%s\" has wrong magic %u instead of %u", errmsg("replication slot file \"%s\" has wrong magic number: %u instead of %u",
path, cp.magic, SLOT_MAGIC))); path, cp.magic, SLOT_MAGIC)));
/* verify version */ /* verify version */
...@@ -1223,7 +1223,7 @@ RestoreSlotFromDisk(const char *name) ...@@ -1223,7 +1223,7 @@ RestoreSlotFromDisk(const char *name)
if (!EQ_CRC32C(checksum, cp.checksum)) if (!EQ_CRC32C(checksum, cp.checksum))
ereport(PANIC, ereport(PANIC,
(errmsg("replication slot file %s: checksum mismatch, is %u, should be %u", (errmsg("checksum mismatch for replication slot file \"%s\": is %u, should be %u",
path, checksum, cp.checksum))); path, checksum, cp.checksum)));
/* /*
......
...@@ -3900,7 +3900,7 @@ PostgresMain(int argc, char *argv[], ...@@ -3900,7 +3900,7 @@ PostgresMain(int argc, char *argv[],
if (pq_is_reading_msg()) if (pq_is_reading_msg())
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")));
/* Now we can allow interrupts again */ /* Now we can allow interrupts again */
RESUME_INTERRUPTS(); RESUME_INTERRUPTS();
......
...@@ -721,7 +721,7 @@ datum_to_jsonb(Datum val, bool is_null, JsonbInState *result, ...@@ -721,7 +721,7 @@ datum_to_jsonb(Datum val, bool is_null, JsonbInState *result,
{ {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("key value must be scalar, not array, composite or json"))); errmsg("key value must be scalar, not array, composite, or json")));
} }
else else
{ {
......
...@@ -168,7 +168,7 @@ pg_cancel_backend(PG_FUNCTION_ARGS) ...@@ -168,7 +168,7 @@ pg_cancel_backend(PG_FUNCTION_ARGS)
if (r == SIGNAL_BACKEND_NOPERMISSION) if (r == SIGNAL_BACKEND_NOPERMISSION)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be a member of the role whose query is being cancelled")))); (errmsg("must be a member of the role whose query is being canceled"))));
PG_RETURN_BOOL(r == SIGNAL_BACKEND_SUCCESS); PG_RETURN_BOOL(r == SIGNAL_BACKEND_SUCCESS);
} }
......
...@@ -2805,7 +2805,9 @@ printPsetInfo(const char *param, struct printQueryOpt *popt) ...@@ -2805,7 +2805,9 @@ printPsetInfo(const char *param, struct printQueryOpt *popt)
/* show minimum lines for pager use */ /* show minimum lines for pager use */
else if (strcmp(param, "pager_min_lines") == 0) else if (strcmp(param, "pager_min_lines") == 0)
{ {
printf(_("Pager won't be used for less than %d lines\n"), printf(ngettext("Pager won't be used for less than %d line.\n",
"Pager won't be used for less than %d lines.\n",
popt->topt.pager_min_lines),
popt->topt.pager_min_lines); popt->topt.pager_min_lines);
} }
......
...@@ -62,7 +62,7 @@ SELECT * FROM rls_test_permissive; ...@@ -62,7 +62,7 @@ SELECT * FROM rls_test_permissive;
INSERT INTO rls_test_permissive VALUES ('r1','s1',10); INSERT INTO rls_test_permissive VALUES ('r1','s1',10);
-- failure -- failure
INSERT INTO rls_test_permissive VALUES ('r4','s4',10); INSERT INTO rls_test_permissive VALUES ('r4','s4',10);
ERROR: new row violates row level security policy for "rls_test_permissive" ERROR: new row violates row-level security policy for table "rls_test_permissive"
SET ROLE s1; SET ROLE s1;
-- With only the hook's policies, restrictive -- With only the hook's policies, restrictive
-- hook's policy is current_user = supervisor -- hook's policy is current_user = supervisor
...@@ -83,7 +83,7 @@ SELECT * FROM rls_test_restrictive; ...@@ -83,7 +83,7 @@ SELECT * FROM rls_test_restrictive;
INSERT INTO rls_test_restrictive VALUES ('r1','s1',10); INSERT INTO rls_test_restrictive VALUES ('r1','s1',10);
-- failure -- failure
INSERT INTO rls_test_restrictive VALUES ('r4','s4',10); INSERT INTO rls_test_restrictive VALUES ('r4','s4',10);
ERROR: new row violates row level security policy "extension policy" for "rls_test_restrictive" ERROR: new row violates row-level security policy "extension policy" for table "rls_test_restrictive"
SET ROLE s1; SET ROLE s1;
-- With only the hook's policies, both -- With only the hook's policies, both
-- permissive hook's policy is current_user = username -- permissive hook's policy is current_user = username
...@@ -103,13 +103,13 @@ SELECT * FROM rls_test_both; ...@@ -103,13 +103,13 @@ SELECT * FROM rls_test_both;
-- failure -- failure
INSERT INTO rls_test_both VALUES ('r1','s1',10); INSERT INTO rls_test_both VALUES ('r1','s1',10);
ERROR: new row violates row level security policy for "rls_test_both" ERROR: new row violates row-level security policy for table "rls_test_both"
-- failure -- failure
INSERT INTO rls_test_both VALUES ('r4','s1',10); INSERT INTO rls_test_both VALUES ('r4','s1',10);
ERROR: new row violates row level security policy for "rls_test_both" ERROR: new row violates row-level security policy for table "rls_test_both"
-- failure -- failure
INSERT INTO rls_test_both VALUES ('r4','s4',10); INSERT INTO rls_test_both VALUES ('r4','s4',10);
ERROR: new row violates row level security policy for "rls_test_both" ERROR: new row violates row-level security policy for table "rls_test_both"
RESET ROLE; RESET ROLE;
-- Create "internal" policies, to check that the policies from -- Create "internal" policies, to check that the policies from
-- the hooks are combined correctly. -- the hooks are combined correctly.
...@@ -141,7 +141,7 @@ INSERT INTO rls_test_permissive VALUES ('r1','s1',7); ...@@ -141,7 +141,7 @@ INSERT INTO rls_test_permissive VALUES ('r1','s1',7);
INSERT INTO rls_test_permissive VALUES ('r3','s3',10); INSERT INTO rls_test_permissive VALUES ('r3','s3',10);
-- failure -- failure
INSERT INTO rls_test_permissive VALUES ('r4','s4',7); INSERT INTO rls_test_permissive VALUES ('r4','s4',7);
ERROR: new row violates row level security policy for "rls_test_permissive" ERROR: new row violates row-level security policy for table "rls_test_permissive"
SET ROLE s1; SET ROLE s1;
-- With both internal and hook policies, restrictive -- With both internal and hook policies, restrictive
EXPLAIN (costs off) SELECT * FROM rls_test_restrictive; EXPLAIN (costs off) SELECT * FROM rls_test_restrictive;
...@@ -163,13 +163,13 @@ SELECT * FROM rls_test_restrictive; ...@@ -163,13 +163,13 @@ SELECT * FROM rls_test_restrictive;
INSERT INTO rls_test_restrictive VALUES ('r1','s1',8); INSERT INTO rls_test_restrictive VALUES ('r1','s1',8);
-- failure -- failure
INSERT INTO rls_test_restrictive VALUES ('r3','s3',10); INSERT INTO rls_test_restrictive VALUES ('r3','s3',10);
ERROR: new row violates row level security policy "extension policy" for "rls_test_restrictive" ERROR: new row violates row-level security policy "extension policy" for table "rls_test_restrictive"
-- failure -- failure
INSERT INTO rls_test_restrictive VALUES ('r1','s1',7); INSERT INTO rls_test_restrictive VALUES ('r1','s1',7);
ERROR: new row violates row level security policy for "rls_test_restrictive" ERROR: new row violates row-level security policy for table "rls_test_restrictive"
-- failure -- failure
INSERT INTO rls_test_restrictive VALUES ('r4','s4',7); INSERT INTO rls_test_restrictive VALUES ('r4','s4',7);
ERROR: new row violates row level security policy for "rls_test_restrictive" ERROR: new row violates row-level security policy for table "rls_test_restrictive"
-- With both internal and hook policies, both permissive -- With both internal and hook policies, both permissive
-- and restrictive hook policies -- and restrictive hook policies
EXPLAIN (costs off) SELECT * FROM rls_test_both; EXPLAIN (costs off) SELECT * FROM rls_test_both;
...@@ -190,13 +190,13 @@ SELECT * FROM rls_test_both; ...@@ -190,13 +190,13 @@ SELECT * FROM rls_test_both;
INSERT INTO rls_test_both VALUES ('r1','s1',8); INSERT INTO rls_test_both VALUES ('r1','s1',8);
-- failure -- failure
INSERT INTO rls_test_both VALUES ('r3','s3',10); INSERT INTO rls_test_both VALUES ('r3','s3',10);
ERROR: new row violates row level security policy "extension policy" for "rls_test_both" ERROR: new row violates row-level security policy "extension policy" for table "rls_test_both"
-- failure -- failure
INSERT INTO rls_test_both VALUES ('r1','s1',7); INSERT INTO rls_test_both VALUES ('r1','s1',7);
ERROR: new row violates row level security policy for "rls_test_both" ERROR: new row violates row-level security policy for table "rls_test_both"
-- failure -- failure
INSERT INTO rls_test_both VALUES ('r4','s4',7); INSERT INTO rls_test_both VALUES ('r4','s4',7);
ERROR: new row violates row level security policy for "rls_test_both" ERROR: new row violates row-level security policy for table "rls_test_both"
RESET ROLE; RESET ROLE;
DROP TABLE rls_test_restrictive; DROP TABLE rls_test_restrictive;
DROP TABLE rls_test_permissive; DROP TABLE rls_test_permissive;
......
...@@ -1375,11 +1375,11 @@ SELECT jsonb_build_object(1,2); ...@@ -1375,11 +1375,11 @@ SELECT jsonb_build_object(1,2);
SELECT jsonb_build_object(null,2); SELECT jsonb_build_object(null,2);
ERROR: arg 1: key cannot be null ERROR: arg 1: key cannot 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);
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('{1,2,3}'::int[], 3); SELECT jsonb_build_object('{1,2,3}'::int[], 3);
ERROR: key value must be scalar, not array, composite or json ERROR: key value must be scalar, not array, composite, or json
-- handling of NULL values -- handling of NULL values
SELECT jsonb_object_agg(1, NULL::jsonb); SELECT jsonb_object_agg(1, NULL::jsonb);
jsonb_object_agg jsonb_object_agg
......
...@@ -411,7 +411,7 @@ REFRESH MATERIALIZED VIEW mv; ...@@ -411,7 +411,7 @@ REFRESH MATERIALIZED VIEW mv;
ERROR: could not create unique index "mv_a_idx" ERROR: could not create unique index "mv_a_idx"
DETAIL: Key (a)=(1) is duplicated. DETAIL: Key (a)=(1) is duplicated.
REFRESH MATERIALIZED VIEW CONCURRENTLY mv; REFRESH MATERIALIZED VIEW CONCURRENTLY mv;
ERROR: new data for "mv" contains duplicate rows without any null columns ERROR: new data for materialized view "mv" contains duplicate rows without any null columns
DETAIL: Row: (1,10) DETAIL: Row: (1,10)
DROP TABLE foo CASCADE; DROP TABLE foo CASCADE;
NOTICE: drop cascades to materialized view mv NOTICE: drop cascades to materialized view mv
......
...@@ -330,9 +330,9 @@ SELECT * FROM document WHERE did = 8; -- and confirm we can't see it ...@@ -330,9 +330,9 @@ SELECT * FROM document WHERE did = 8; -- and confirm we can't see it
-- RLS policies are checked before constraints -- RLS policies are checked before constraints
INSERT INTO document VALUES (8, 44, 1, 'rls_regress_user2', 'my third manga'); -- Should fail with RLS check violation, not duplicate key violation INSERT INTO document VALUES (8, 44, 1, 'rls_regress_user2', 'my third manga'); -- Should fail with RLS check violation, not duplicate key violation
ERROR: new row violates row level security policy for "document" ERROR: new row violates row-level security policy for table "document"
UPDATE document SET did = 8, dauthor = 'rls_regress_user2' WHERE did = 5; -- Should fail with RLS check violation, not duplicate key violation UPDATE document SET did = 8, dauthor = 'rls_regress_user2' WHERE did = 5; -- Should fail with RLS check violation, not duplicate key violation
ERROR: new row violates row level security policy for "document" ERROR: new row violates row-level security policy for table "document"
-- database superuser does bypass RLS policy when enabled -- database superuser does bypass RLS policy when enabled
RESET SESSION AUTHORIZATION; RESET SESSION AUTHORIZATION;
SET row_security TO ON; SET row_security TO ON;
...@@ -1453,9 +1453,9 @@ NOTICE: f_leak => d3d9446802a44259755d38e6d163e820 ...@@ -1453,9 +1453,9 @@ NOTICE: f_leak => d3d9446802a44259755d38e6d163e820
(5 rows) (5 rows)
INSERT INTO bv1 VALUES (-1, 'xxx'); -- should fail view WCO INSERT INTO bv1 VALUES (-1, 'xxx'); -- should fail view WCO
ERROR: new row violates row level security policy for "b1" ERROR: new row violates row-level security policy for table "b1"
INSERT INTO bv1 VALUES (11, 'xxx'); -- should fail RLS check INSERT INTO bv1 VALUES (11, 'xxx'); -- should fail RLS check
ERROR: new row violates row level security policy for "b1" ERROR: new row violates row-level security policy for table "b1"
INSERT INTO bv1 VALUES (12, 'xxx'); -- ok INSERT INTO bv1 VALUES (12, 'xxx'); -- ok
EXPLAIN (COSTS OFF) UPDATE bv1 SET b = 'yyy' WHERE a = 4 AND f_leak(b); EXPLAIN (COSTS OFF) UPDATE bv1 SET b = 'yyy' WHERE a = 4 AND f_leak(b);
QUERY PLAN QUERY PLAN
...@@ -1534,7 +1534,7 @@ SELECT * FROM document WHERE did = 2; ...@@ -1534,7 +1534,7 @@ SELECT * FROM document WHERE did = 2;
-- alternative UPDATE path happens to be taken): -- alternative UPDATE path happens to be taken):
INSERT INTO document VALUES (2, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user2', 'my first novel') INSERT INTO document VALUES (2, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user2', 'my first novel')
ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle, dauthor = EXCLUDED.dauthor; ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle, dauthor = EXCLUDED.dauthor;
ERROR: new row violates row level security policy for "document" ERROR: new row violates row-level security policy for table "document"
-- Violates USING qual for UPDATE policy p3. -- Violates USING qual for UPDATE policy p3.
-- --
-- UPDATE path is taken, but UPDATE fails purely because *existing* row to be -- UPDATE path is taken, but UPDATE fails purely because *existing* row to be
...@@ -1543,7 +1543,7 @@ ERROR: new row violates row level security policy for "document" ...@@ -1543,7 +1543,7 @@ ERROR: new row violates row level security policy for "document"
INSERT INTO document VALUES (33, 22, 1, 'rls_regress_user1', 'okay science fiction'); -- preparation for next statement INSERT INTO document VALUES (33, 22, 1, 'rls_regress_user1', 'okay science fiction'); -- preparation for next statement
INSERT INTO document VALUES (33, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user1', 'Some novel, replaces sci-fi') -- takes UPDATE path INSERT INTO document VALUES (33, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user1', 'Some novel, replaces sci-fi') -- takes UPDATE path
ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle; ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle;
ERROR: new row violates row level security policy (USING expression) for "document" ERROR: new row violates row-level security policy (USING expression) for table "document"
-- Fine (we UPDATE, since INSERT WCOs and UPDATE security barrier quals + WCOs -- Fine (we UPDATE, since INSERT WCOs and UPDATE security barrier quals + WCOs
-- not violated): -- not violated):
INSERT INTO document VALUES (2, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user1', 'my first novel') INSERT INTO document VALUES (2, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user1', 'my first novel')
...@@ -1574,7 +1574,7 @@ INSERT INTO document VALUES (78, (SELECT cid from category WHERE cname = 'novel' ...@@ -1574,7 +1574,7 @@ INSERT INTO document VALUES (78, (SELECT cid from category WHERE cname = 'novel'
-- passing quals: -- passing quals:
INSERT INTO document VALUES (78, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user1', 'some technology novel') INSERT INTO document VALUES (78, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user1', 'some technology novel')
ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle, cid = 33 RETURNING *; ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle, cid = 33 RETURNING *;
ERROR: new row violates row level security policy (USING expression) for "document" ERROR: new row violates row-level security policy (USING expression) for table "document"
-- Don't fail just because INSERT doesn't satisfy WITH CHECK option that -- Don't fail just because INSERT doesn't satisfy WITH CHECK option that
-- originated as a barrier/USING() qual from the UPDATE. Note that the UPDATE -- originated as a barrier/USING() qual from the UPDATE. Note that the UPDATE
-- path *isn't* taken, and so UPDATE-related policy does not apply: -- path *isn't* taken, and so UPDATE-related policy does not apply:
...@@ -1591,7 +1591,7 @@ INSERT INTO document VALUES (79, (SELECT cid from category WHERE cname = 'techno ...@@ -1591,7 +1591,7 @@ INSERT INTO document VALUES (79, (SELECT cid from category WHERE cname = 'techno
-- irrelevant, in fact. -- irrelevant, in fact.
INSERT INTO document VALUES (79, (SELECT cid from category WHERE cname = 'technology'), 1, 'rls_regress_user1', 'technology book, can only insert') INSERT INTO document VALUES (79, (SELECT cid from category WHERE cname = 'technology'), 1, 'rls_regress_user1', 'technology book, can only insert')
ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle RETURNING *; ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle RETURNING *;
ERROR: new row violates row level security policy (USING expression) for "document" ERROR: new row violates row-level security policy (USING expression) for table "document"
-- Test default USING qual enforced as WCO -- Test default USING qual enforced as WCO
SET SESSION AUTHORIZATION rls_regress_user0; SET SESSION AUTHORIZATION rls_regress_user0;
DROP POLICY p1 ON document; DROP POLICY p1 ON document;
...@@ -1613,14 +1613,14 @@ SET SESSION AUTHORIZATION rls_regress_user1; ...@@ -1613,14 +1613,14 @@ SET SESSION AUTHORIZATION rls_regress_user1;
-- UPDATE to make this fail: -- UPDATE to make this fail:
INSERT INTO document VALUES (79, (SELECT cid from category WHERE cname = 'technology'), 1, 'rls_regress_user1', 'technology book, can only insert') INSERT INTO document VALUES (79, (SELECT cid from category WHERE cname = 'technology'), 1, 'rls_regress_user1', 'technology book, can only insert')
ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle RETURNING *; ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle RETURNING *;
ERROR: new row violates row level security policy for "document" ERROR: new row violates row-level security policy for table "document"
-- UPDATE path is taken here. Existing tuple passes, since it's cid -- UPDATE path is taken here. Existing tuple passes, since it's cid
-- corresponds to "novel", but default USING qual is enforced against -- corresponds to "novel", but default USING qual is enforced against
-- post-UPDATE tuple too (as always when updating with a policy that lacks an -- post-UPDATE tuple too (as always when updating with a policy that lacks an
-- explicit WCO), and so this fails: -- explicit WCO), and so this fails:
INSERT INTO document VALUES (2, (SELECT cid from category WHERE cname = 'technology'), 1, 'rls_regress_user1', 'my first novel') INSERT INTO document VALUES (2, (SELECT cid from category WHERE cname = 'technology'), 1, 'rls_regress_user1', 'my first novel')
ON CONFLICT (did) DO UPDATE SET cid = EXCLUDED.cid, dtitle = EXCLUDED.dtitle RETURNING *; ON CONFLICT (did) DO UPDATE SET cid = EXCLUDED.cid, dtitle = EXCLUDED.dtitle RETURNING *;
ERROR: new row violates row level security policy for "document" ERROR: new row violates row-level security policy for table "document"
SET SESSION AUTHORIZATION rls_regress_user0; SET SESSION AUTHORIZATION rls_regress_user0;
DROP POLICY p3_with_default ON document; DROP POLICY p3_with_default ON document;
-- --
...@@ -1634,16 +1634,16 @@ SET SESSION AUTHORIZATION rls_regress_user1; ...@@ -1634,16 +1634,16 @@ SET SESSION AUTHORIZATION rls_regress_user1;
-- Fails, since ALL WCO is enforced in insert path: -- Fails, since ALL WCO is enforced in insert path:
INSERT INTO document VALUES (80, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user2', 'my first novel') INSERT INTO document VALUES (80, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user2', 'my first novel')
ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle, cid = 33; ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle, cid = 33;
ERROR: new row violates row level security policy for "document" ERROR: new row violates row-level security policy for table "document"
-- Fails, since ALL policy USING qual is enforced (existing, target tuple is in -- Fails, since ALL policy USING qual is enforced (existing, target tuple is in
-- violation, since it has the "manga" cid): -- violation, since it has the "manga" cid):
INSERT INTO document VALUES (4, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user1', 'my first novel') INSERT INTO document VALUES (4, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user1', 'my first novel')
ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle; ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle;
ERROR: new row violates row level security policy (USING expression) for "document" ERROR: new row violates row-level security policy (USING expression) for table "document"
-- Fails, since ALL WCO are enforced: -- Fails, since ALL WCO are enforced:
INSERT INTO document VALUES (1, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user1', 'my first novel') INSERT INTO document VALUES (1, (SELECT cid from category WHERE cname = 'novel'), 1, 'rls_regress_user1', 'my first novel')
ON CONFLICT (did) DO UPDATE SET dauthor = 'rls_regress_user2'; ON CONFLICT (did) DO UPDATE SET dauthor = 'rls_regress_user2';
ERROR: new row violates row level security policy for "document" ERROR: new row violates row-level security policy for table "document"
-- --
-- ROLE/GROUP -- ROLE/GROUP
-- --
...@@ -2249,7 +2249,7 @@ EXPLAIN (COSTS OFF) WITH cte1 AS (SELECT * FROM t1 WHERE f_leak(b)) SELECT * FRO ...@@ -2249,7 +2249,7 @@ EXPLAIN (COSTS OFF) WITH cte1 AS (SELECT * FROM t1 WHERE f_leak(b)) SELECT * FRO
(6 rows) (6 rows)
WITH cte1 AS (UPDATE t1 SET a = a + 1 RETURNING *) SELECT * FROM cte1; --fail WITH cte1 AS (UPDATE t1 SET a = a + 1 RETURNING *) SELECT * FROM cte1; --fail
ERROR: new row violates row level security policy for "t1" ERROR: new row violates row-level security policy for table "t1"
WITH cte1 AS (UPDATE t1 SET a = a RETURNING *) SELECT * FROM cte1; --ok WITH cte1 AS (UPDATE t1 SET a = a RETURNING *) SELECT * FROM cte1; --ok
a | b a | b
----+---------------------------------- ----+----------------------------------
...@@ -2267,7 +2267,7 @@ WITH cte1 AS (UPDATE t1 SET a = a RETURNING *) SELECT * FROM cte1; --ok ...@@ -2267,7 +2267,7 @@ WITH cte1 AS (UPDATE t1 SET a = a RETURNING *) SELECT * FROM cte1; --ok
(11 rows) (11 rows)
WITH cte1 AS (INSERT INTO t1 VALUES (21, 'Fail') RETURNING *) SELECT * FROM cte1; --fail WITH cte1 AS (INSERT INTO t1 VALUES (21, 'Fail') RETURNING *) SELECT * FROM cte1; --fail
ERROR: new row violates row level security policy for "t1" ERROR: new row violates row-level security policy for table "t1"
WITH cte1 AS (INSERT INTO t1 VALUES (20, 'Success') RETURNING *) SELECT * FROM cte1; --ok WITH cte1 AS (INSERT INTO t1 VALUES (20, 'Success') RETURNING *) SELECT * FROM cte1; --ok
a | b a | b
----+--------- ----+---------
...@@ -2675,7 +2675,7 @@ ERROR: insufficient privilege to bypass row security. ...@@ -2675,7 +2675,7 @@ ERROR: insufficient privilege to bypass row 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 direct 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;
SET row_security TO ON; SET row_security TO ON;
...@@ -2978,7 +2978,7 @@ SELECT * FROM r2; ...@@ -2978,7 +2978,7 @@ SELECT * FROM r2;
-- r2 is read-only -- r2 is read-only
INSERT INTO r2 VALUES (2); -- Not allowed INSERT INTO r2 VALUES (2); -- Not allowed
ERROR: new row violates row level security policy for "r2" ERROR: new row violates row-level security policy for table "r2"
UPDATE r2 SET a = 2 RETURNING *; -- Updates nothing UPDATE r2 SET a = 2 RETURNING *; -- Updates nothing
a a
--- ---
...@@ -3047,7 +3047,7 @@ TABLE r1; ...@@ -3047,7 +3047,7 @@ TABLE r1;
-- RLS error -- RLS error
INSERT INTO r1 VALUES (1); INSERT INTO r1 VALUES (1);
ERROR: new row violates row level security policy for "r1" ERROR: new row violates row-level security policy for table "r1"
-- No error (unable to see any rows to update) -- No error (unable to see any rows to update)
UPDATE r1 SET a = 1; UPDATE r1 SET a = 1;
TABLE r1; TABLE r1;
...@@ -3208,7 +3208,7 @@ TABLE r1; ...@@ -3208,7 +3208,7 @@ TABLE r1;
SET row_security = on; SET row_security = on;
-- Error -- Error
INSERT INTO r1 VALUES (10), (20) RETURNING *; INSERT INTO r1 VALUES (10), (20) RETURNING *;
ERROR: new row violates row level security policy for "r1" ERROR: new row violates row-level security policy for table "r1"
DROP TABLE r1; DROP TABLE r1;
-- --
-- Test UPDATE+RETURNING applies SELECT policies as -- Test UPDATE+RETURNING applies SELECT policies as
...@@ -3244,7 +3244,7 @@ TABLE r1; ...@@ -3244,7 +3244,7 @@ TABLE r1;
SET row_security = on; SET row_security = on;
-- Error -- Error
UPDATE r1 SET a = 30 RETURNING *; UPDATE r1 SET a = 30 RETURNING *;
ERROR: new row violates row level security policy for "r1" ERROR: new row violates row-level security policy for table "r1"
DROP TABLE r1; DROP TABLE r1;
-- --
-- Clean up objects -- Clean up objects
......
...@@ -1456,18 +1456,18 @@ SELECT * FROM information_schema.views WHERE table_name = 'rw_view1'; ...@@ -1456,18 +1456,18 @@ SELECT * FROM information_schema.views WHERE table_name = 'rw_view1';
INSERT INTO rw_view1 VALUES(3,4); -- ok INSERT INTO rw_view1 VALUES(3,4); -- ok
INSERT INTO rw_view1 VALUES(4,3); -- should fail INSERT INTO rw_view1 VALUES(4,3); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (4, 3). DETAIL: Failing row contains (4, 3).
INSERT INTO rw_view1 VALUES(5,null); -- should fail INSERT INTO rw_view1 VALUES(5,null); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (5, null). DETAIL: Failing row contains (5, null).
UPDATE rw_view1 SET b = 5 WHERE a = 3; -- ok UPDATE rw_view1 SET b = 5 WHERE a = 3; -- ok
UPDATE rw_view1 SET b = -5 WHERE a = 3; -- should fail UPDATE rw_view1 SET b = -5 WHERE a = 3; -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (3, -5). DETAIL: Failing row contains (3, -5).
INSERT INTO rw_view1(a) VALUES (9); -- ok INSERT INTO rw_view1(a) VALUES (9); -- ok
INSERT INTO rw_view1(a) VALUES (10); -- should fail INSERT INTO rw_view1(a) VALUES (10); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (10, 10). DETAIL: Failing row contains (10, 10).
SELECT * FROM base_tbl; SELECT * FROM base_tbl;
a | b a | b
...@@ -1506,11 +1506,11 @@ SELECT * FROM information_schema.views WHERE table_name = 'rw_view2'; ...@@ -1506,11 +1506,11 @@ SELECT * FROM information_schema.views WHERE table_name = 'rw_view2';
(1 row) (1 row)
INSERT INTO rw_view2 VALUES (-5); -- should fail INSERT INTO rw_view2 VALUES (-5); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (-5). DETAIL: Failing row contains (-5).
INSERT INTO rw_view2 VALUES (5); -- ok INSERT INTO rw_view2 VALUES (5); -- ok
INSERT INTO rw_view2 VALUES (15); -- should fail INSERT INTO rw_view2 VALUES (15); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view2" ERROR: new row violates check option for view "rw_view2"
DETAIL: Failing row contains (15). DETAIL: Failing row contains (15).
SELECT * FROM base_tbl; SELECT * FROM base_tbl;
a a
...@@ -1519,10 +1519,10 @@ SELECT * FROM base_tbl; ...@@ -1519,10 +1519,10 @@ SELECT * FROM base_tbl;
(1 row) (1 row)
UPDATE rw_view2 SET a = a - 10; -- should fail UPDATE rw_view2 SET a = a - 10; -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (-5). DETAIL: Failing row contains (-5).
UPDATE rw_view2 SET a = a + 10; -- should fail UPDATE rw_view2 SET a = a + 10; -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view2" ERROR: new row violates check option for view "rw_view2"
DETAIL: Failing row contains (15). DETAIL: Failing row contains (15).
CREATE OR REPLACE VIEW rw_view2 AS SELECT * FROM rw_view1 WHERE a < 10 CREATE OR REPLACE VIEW rw_view2 AS SELECT * FROM rw_view1 WHERE a < 10
WITH LOCAL CHECK OPTION; WITH LOCAL CHECK OPTION;
...@@ -1547,7 +1547,7 @@ SELECT * FROM information_schema.views WHERE table_name = 'rw_view2'; ...@@ -1547,7 +1547,7 @@ SELECT * FROM information_schema.views WHERE table_name = 'rw_view2';
INSERT INTO rw_view2 VALUES (-10); -- ok, but not in view INSERT INTO rw_view2 VALUES (-10); -- ok, but not in view
INSERT INTO rw_view2 VALUES (20); -- should fail INSERT INTO rw_view2 VALUES (20); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view2" ERROR: new row violates check option for view "rw_view2"
DETAIL: Failing row contains (20). DETAIL: Failing row contains (20).
SELECT * FROM base_tbl; SELECT * FROM base_tbl;
a a
...@@ -1561,10 +1561,10 @@ ERROR: invalid value for "check_option" option ...@@ -1561,10 +1561,10 @@ ERROR: invalid value for "check_option" option
DETAIL: Valid values are "local" and "cascaded". DETAIL: Valid values are "local" and "cascaded".
ALTER VIEW rw_view1 SET (check_option=local); ALTER VIEW rw_view1 SET (check_option=local);
INSERT INTO rw_view2 VALUES (-20); -- should fail INSERT INTO rw_view2 VALUES (-20); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (-20). DETAIL: Failing row contains (-20).
INSERT INTO rw_view2 VALUES (30); -- should fail INSERT INTO rw_view2 VALUES (30); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view2" ERROR: new row violates check option for view "rw_view2"
DETAIL: Failing row contains (30). DETAIL: Failing row contains (30).
ALTER VIEW rw_view2 RESET (check_option); ALTER VIEW rw_view2 RESET (check_option);
\d+ rw_view2 \d+ rw_view2
...@@ -1620,7 +1620,7 @@ INSERT INTO rw_view1 VALUES (1); -- ok ...@@ -1620,7 +1620,7 @@ INSERT INTO rw_view1 VALUES (1); -- ok
INSERT INTO rw_view2 VALUES (-2); -- ok, but not in view INSERT INTO rw_view2 VALUES (-2); -- ok, but not in view
INSERT INTO rw_view2 VALUES (2); -- ok INSERT INTO rw_view2 VALUES (2); -- ok
INSERT INTO rw_view3 VALUES (-3); -- should fail INSERT INTO rw_view3 VALUES (-3); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view2" ERROR: new row violates check option for view "rw_view2"
DETAIL: Failing row contains (-3). DETAIL: Failing row contains (-3).
INSERT INTO rw_view3 VALUES (3); -- ok INSERT INTO rw_view3 VALUES (3); -- ok
DROP TABLE base_tbl CASCADE; DROP TABLE base_tbl CASCADE;
...@@ -1634,16 +1634,16 @@ CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a = ANY (b) ...@@ -1634,16 +1634,16 @@ CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a = ANY (b)
WITH CHECK OPTION; WITH CHECK OPTION;
INSERT INTO rw_view1 VALUES (1, ARRAY[1,2,3]); -- ok INSERT INTO rw_view1 VALUES (1, ARRAY[1,2,3]); -- ok
INSERT INTO rw_view1 VALUES (10, ARRAY[4,5]); -- should fail INSERT INTO rw_view1 VALUES (10, ARRAY[4,5]); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (10, {4,5}). DETAIL: Failing row contains (10, {4,5}).
UPDATE rw_view1 SET b[2] = -b[2] WHERE a = 1; -- ok UPDATE rw_view1 SET b[2] = -b[2] WHERE a = 1; -- ok
UPDATE rw_view1 SET b[1] = -b[1] WHERE a = 1; -- should fail UPDATE rw_view1 SET b[1] = -b[1] WHERE a = 1; -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (1, {-1,-2,3}). DETAIL: Failing row contains (1, {-1,-2,3}).
PREPARE ins(int, int[]) AS INSERT INTO rw_view1 VALUES($1, $2); PREPARE ins(int, int[]) AS INSERT INTO rw_view1 VALUES($1, $2);
EXECUTE ins(2, ARRAY[1,2,3]); -- ok EXECUTE ins(2, ARRAY[1,2,3]); -- ok
EXECUTE ins(10, ARRAY[4,5]); -- should fail EXECUTE ins(10, ARRAY[4,5]); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (10, {4,5}). DETAIL: Failing row contains (10, {4,5}).
DEALLOCATE PREPARE ins; DEALLOCATE PREPARE ins;
DROP TABLE base_tbl CASCADE; DROP TABLE base_tbl CASCADE;
...@@ -1658,11 +1658,11 @@ CREATE VIEW rw_view1 AS ...@@ -1658,11 +1658,11 @@ CREATE VIEW rw_view1 AS
WITH CHECK OPTION; WITH CHECK OPTION;
INSERT INTO rw_view1 VALUES (5); -- ok INSERT INTO rw_view1 VALUES (5); -- ok
INSERT INTO rw_view1 VALUES (15); -- should fail INSERT INTO rw_view1 VALUES (15); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (15). DETAIL: Failing row contains (15).
UPDATE rw_view1 SET a = a + 5; -- ok UPDATE rw_view1 SET a = a + 5; -- ok
UPDATE rw_view1 SET a = a + 5; -- should fail UPDATE rw_view1 SET a = a + 5; -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (15). DETAIL: Failing row contains (15).
EXPLAIN (costs off) INSERT INTO rw_view1 VALUES (5); EXPLAIN (costs off) INSERT INTO rw_view1 VALUES (5);
QUERY PLAN QUERY PLAN
...@@ -1710,10 +1710,10 @@ CREATE TRIGGER base_tbl_trig BEFORE INSERT OR UPDATE ON base_tbl ...@@ -1710,10 +1710,10 @@ CREATE TRIGGER base_tbl_trig BEFORE INSERT OR UPDATE ON base_tbl
CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a < b WITH CHECK OPTION; CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a < b WITH CHECK OPTION;
INSERT INTO rw_view1 VALUES (5,0); -- ok INSERT INTO rw_view1 VALUES (5,0); -- ok
INSERT INTO rw_view1 VALUES (15, 20); -- should fail INSERT INTO rw_view1 VALUES (15, 20); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (15, 10). DETAIL: Failing row contains (15, 10).
UPDATE rw_view1 SET a = 20, b = 30; -- should fail UPDATE rw_view1 SET a = 20, b = 30; -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view1" ERROR: new row violates check option for view "rw_view1"
DETAIL: Failing row contains (20, 10). DETAIL: Failing row contains (20, 10).
DROP TABLE base_tbl CASCADE; DROP TABLE base_tbl CASCADE;
NOTICE: drop cascades to view rw_view1 NOTICE: drop cascades to view rw_view1
...@@ -1744,12 +1744,12 @@ CREATE TRIGGER rw_view1_trig ...@@ -1744,12 +1744,12 @@ CREATE TRIGGER rw_view1_trig
CREATE VIEW rw_view2 AS CREATE VIEW rw_view2 AS
SELECT * FROM rw_view1 WHERE a > 0 WITH LOCAL CHECK OPTION; SELECT * FROM rw_view1 WHERE a > 0 WITH LOCAL CHECK OPTION;
INSERT INTO rw_view2 VALUES (-5); -- should fail INSERT INTO rw_view2 VALUES (-5); -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view2" ERROR: new row violates check option for view "rw_view2"
DETAIL: Failing row contains (-5). DETAIL: Failing row contains (-5).
INSERT INTO rw_view2 VALUES (5); -- ok INSERT INTO rw_view2 VALUES (5); -- ok
INSERT INTO rw_view2 VALUES (50); -- ok, but not in view INSERT INTO rw_view2 VALUES (50); -- ok, but not in view
UPDATE rw_view2 SET a = a - 10; -- should fail UPDATE rw_view2 SET a = a - 10; -- should fail
ERROR: new row violates WITH CHECK OPTION for "rw_view2" ERROR: new row violates check option for view "rw_view2"
DETAIL: Failing row contains (-5). DETAIL: Failing row contains (-5).
SELECT * FROM base_tbl; SELECT * FROM base_tbl;
a | b a | b
......
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