Commit 578b2297 authored by Andres Freund's avatar Andres Freund

Remove WITH OIDS support, change oid catalog column visibility.

Previously tables declared WITH OIDS, including a significant fraction
of the catalog tables, stored the oid column not as a normal column,
but as part of the tuple header.

This special column was not shown by default, which was somewhat odd,
as it's often (consider e.g. pg_class.oid) one of the more important
parts of a row.  Neither pg_dump nor COPY included the contents of the
oid column by default.

The fact that the oid column was not an ordinary column necessitated a
significant amount of special case code to support oid columns. That
already was painful for the existing, but upcoming work aiming to make
table storage pluggable, would have required expanding and duplicating
that "specialness" significantly.

WITH OIDS has been deprecated since 2005 (commit ff02d0a05280e0).
Remove it.

Removing includes:
- CREATE TABLE and ALTER TABLE syntax for declaring the table to be
  WITH OIDS has been removed (WITH (oids[ = true]) will error out)
- pg_dump does not support dumping tables declared WITH OIDS and will
  issue a warning when dumping one (and ignore the oid column).
- restoring an pg_dump archive with pg_restore will warn when
  restoring a table with oid contents (and ignore the oid column)
- COPY will refuse to load binary dump that includes oids.
- pg_upgrade will error out when encountering tables declared WITH
  OIDS, they have to be altered to remove the oid column first.
- Functionality to access the oid of the last inserted row (like
  plpgsql's RESULT_OID, spi's SPI_lastoid, ...) has been removed.

The syntax for declaring a table WITHOUT OIDS (or WITH (oids = false)
for CREATE TABLE) is still supported. While that requires a bit of
support code, it seems unnecessary to break applications / dumps that
do not use oids, and are explicit about not using them.

The biggest user of WITH OID columns was postgres' catalog. This
commit changes all 'magic' oid columns to be columns that are normally
declared and stored. To reduce unnecessary query breakage all the
newly added columns are still named 'oid', even if a table's column
naming scheme would indicate 'reloid' or such.  This obviously
requires adapting a lot code, mostly replacing oid access via
HeapTupleGetOid() with access to the underlying Form_pg_*->oid column.

The bootstrap process now assigns oids for all oid columns in
genbki.pl that do not have an explicit value (starting at the largest
oid previously used), only oids assigned later by oids will be above
FirstBootstrapObjectId. As the oid column now is a normal column the
special bootstrap syntax for oids has been removed.

Oids are not automatically assigned during insertion anymore, all
backend code explicitly assigns oids with GetNewOidWithIndex(). For
the rare case that insertions into the catalog via SQL are called for
the new pg_nextoid() function can be used (which only works on catalog
tables).

The fact that oid columns on system tables are now normal columns
means that they will be included in the set of columns expanded
by * (i.e. SELECT * FROM pg_class will now include the table's oid,
previously it did not). It'd not technically be hard to hide oid
column by default, but that'd mean confusing behavior would either
have to be carried forward forever, or it'd cause breakage down the
line.

While it's not unlikely that further adjustments are needed, the
scope/invasiveness of the patch makes it worthwhile to get merge this
now. It's painful to maintain externally, too complicated to commit
after the code code freeze, and a dependency of a number of other
patches.

Catversion bump, for obvious reasons.

Author: Andres Freund, with contributions by John Naylor
Discussion: https://postgr.es/m/20180930034810.ywp2c7awz7opzcfr@alap3.anarazel.de
parent 0999ac47
......@@ -502,7 +502,7 @@ pg_logdir_ls_internal(FunctionCallInfo fcinfo)
fctx = palloc(sizeof(directory_fctx));
tupdesc = CreateTemplateTupleDesc(2, false);
tupdesc = CreateTemplateTupleDesc(2);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "starttime",
TIMESTAMPOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "filename",
......
-- money check
CREATE TABLE moneytmp (a money) WITH OIDS;
CREATE TABLE moneytmp (a money);
\copy moneytmp from 'data/cash.data'
SET enable_seqscan=on;
SELECT count(*) FROM moneytmp WHERE a < '22649.64';
......
-- oid check
SET enable_seqscan=on;
SELECT count(*) FROM moneytmp WHERE oid < ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
CREATE TEMPORARY TABLE oidtmp (oid oid);
INSERT INTO oidtmp SELECT g.i::oid FROM generate_series(1, 1000) g(i);
SELECT count(*) FROM oidtmp WHERE oid < 17;
count
-------
372
16
(1 row)
SELECT count(*) FROM moneytmp WHERE oid <= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid <= 17;
count
-------
373
17
(1 row)
SELECT count(*) FROM moneytmp WHERE oid = ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid = 17;
count
-------
1
(1 row)
SELECT count(*) FROM moneytmp WHERE oid >= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid >= 17;
count
-------
228
984
(1 row)
SELECT count(*) FROM moneytmp WHERE oid > ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid > 17;
count
-------
227
983
(1 row)
CREATE INDEX oididx ON moneytmp USING gist ( oid );
CREATE INDEX oididx ON oidtmp USING gist ( oid );
SET enable_seqscan=off;
SELECT count(*) FROM moneytmp WHERE oid < ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid < 17;
count
-------
372
16
(1 row)
SELECT count(*) FROM moneytmp WHERE oid <= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid <= 17;
count
-------
373
17
(1 row)
SELECT count(*) FROM moneytmp WHERE oid = ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid = 17;
count
-------
1
(1 row)
SELECT count(*) FROM moneytmp WHERE oid >= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid >= 17;
count
-------
228
984
(1 row)
SELECT count(*) FROM moneytmp WHERE oid > ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid > 17;
count
-------
227
983
(1 row)
-- money check
CREATE TABLE moneytmp (a money) WITH OIDS;
CREATE TABLE moneytmp (a money);
\copy moneytmp from 'data/cash.data'
......
......@@ -2,26 +2,29 @@
SET enable_seqscan=on;
SELECT count(*) FROM moneytmp WHERE oid < ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
CREATE TEMPORARY TABLE oidtmp (oid oid);
INSERT INTO oidtmp SELECT g.i::oid FROM generate_series(1, 1000) g(i);
SELECT count(*) FROM moneytmp WHERE oid <= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid < 17;
SELECT count(*) FROM moneytmp WHERE oid = ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid <= 17;
SELECT count(*) FROM moneytmp WHERE oid >= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid = 17;
SELECT count(*) FROM moneytmp WHERE oid > ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid >= 17;
CREATE INDEX oididx ON moneytmp USING gist ( oid );
SELECT count(*) FROM oidtmp WHERE oid > 17;
CREATE INDEX oididx ON oidtmp USING gist ( oid );
SET enable_seqscan=off;
SELECT count(*) FROM moneytmp WHERE oid < ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid < 17;
SELECT count(*) FROM moneytmp WHERE oid <= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid <= 17;
SELECT count(*) FROM moneytmp WHERE oid = ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid = 17;
SELECT count(*) FROM moneytmp WHERE oid >= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid >= 17;
SELECT count(*) FROM moneytmp WHERE oid > ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
SELECT count(*) FROM oidtmp WHERE oid > 17;
......@@ -849,7 +849,7 @@ materializeResult(FunctionCallInfo fcinfo, PGconn *conn, PGresult *res)
* need a tuple descriptor representing one TEXT column to return
* the command status string as our result tuple
*/
tupdesc = CreateTemplateTupleDesc(1, false);
tupdesc = CreateTemplateTupleDesc(1);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "status",
TEXTOID, -1, 0);
ntuples = 1;
......@@ -1032,7 +1032,7 @@ materializeQueryResult(FunctionCallInfo fcinfo,
* need a tuple descriptor representing one TEXT column to return
* the command status string as our result tuple
*/
tupdesc = CreateTemplateTupleDesc(1, false);
tupdesc = CreateTemplateTupleDesc(1);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "status",
TEXTOID, -1, 0);
attinmeta = TupleDescGetAttInMetadata(tupdesc);
......@@ -1526,7 +1526,7 @@ dblink_get_pkey(PG_FUNCTION_ARGS)
/*
* need a tuple descriptor representing one INT and one TEXT column
*/
tupdesc = CreateTemplateTupleDesc(2, false);
tupdesc = CreateTemplateTupleDesc(2);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "position",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "colname",
......@@ -1904,7 +1904,7 @@ dblink_get_notify(PG_FUNCTION_ARGS)
per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;
oldcontext = MemoryContextSwitchTo(per_query_ctx);
tupdesc = CreateTemplateTupleDesc(DBLINK_NOTIFY_COLS, false);
tupdesc = CreateTemplateTupleDesc(DBLINK_NOTIFY_COLS);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "notify_name",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "be_pid",
......
......@@ -727,8 +727,7 @@ fileIterateForeignScan(ForeignScanState *node)
*/
ExecClearTuple(slot);
found = NextCopyFrom(festate->cstate, NULL,
slot->tts_values, slot->tts_isnull,
NULL);
slot->tts_values, slot->tts_isnull);
if (found)
ExecStoreVirtualTuple(slot);
......@@ -1148,7 +1147,7 @@ file_acquire_sample_rows(Relation onerel, int elevel,
MemoryContextReset(tupcontext);
MemoryContextSwitchTo(tupcontext);
found = NextCopyFrom(cstate, NULL, values, nulls, NULL);
found = NextCopyFrom(cstate, NULL, values, nulls);
MemoryContextSwitchTo(oldcontext);
......
......@@ -35,6 +35,19 @@
#include "utils/builtins.h"
#include "utils/rel.h"
/*
* It's not supported to create tuples with oids anymore, but when pg_upgrade
* was used to upgrade from an older version, tuples might still have an
* oid. Seems worthwhile to display that.
*/
#define HeapTupleHeaderGetOidOld(tup) \
( \
((tup)->t_infomask & HEAP_HASOID_OLD) ? \
*((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) \
: \
InvalidOid \
)
/*
* bits_to_text
......@@ -241,8 +254,8 @@ heap_page_items(PG_FUNCTION_ARGS)
else
nulls[11] = true;
if (tuphdr->t_infomask & HEAP_HASOID)
values[12] = HeapTupleHeaderGetOid(tuphdr);
if (tuphdr->t_infomask & HEAP_HASOID_OLD)
values[12] = HeapTupleHeaderGetOidOld(tuphdr);
else
nulls[12] = true;
}
......
......@@ -99,7 +99,7 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
elog(ERROR, "incorrect number of output arguments");
/* Construct a tuple descriptor for the result rows. */
tupledesc = CreateTemplateTupleDesc(expected_tupledesc->natts, false);
tupledesc = CreateTemplateTupleDesc(expected_tupledesc->natts);
TupleDescInitEntry(tupledesc, (AttrNumber) 1, "bufferid",
INT4OID, -1, 0);
TupleDescInitEntry(tupledesc, (AttrNumber) 2, "relfilenode",
......
......@@ -292,7 +292,7 @@ pg_visibility_map_summary(PG_FUNCTION_ARGS)
ReleaseBuffer(vmbuffer);
relation_close(rel, AccessShareLock);
tupdesc = CreateTemplateTupleDesc(2, false);
tupdesc = CreateTemplateTupleDesc(2);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "all_visible", INT8OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "all_frozen", INT8OID, -1, 0);
tupdesc = BlessTupleDesc(tupdesc);
......@@ -447,7 +447,7 @@ pg_visibility_tupdesc(bool include_blkno, bool include_pd)
++maxattr;
if (include_pd)
++maxattr;
tupdesc = CreateTemplateTupleDesc(maxattr, false);
tupdesc = CreateTemplateTupleDesc(maxattr);
if (include_blkno)
TupleDescInitEntry(tupdesc, ++a, "blkno", INT8OID, -1, 0);
TupleDescInitEntry(tupdesc, ++a, "all_visible", BOOLOID, -1, 0);
......
......@@ -332,14 +332,13 @@ foreign_expr_walker(Node *node,
/* Var belongs to foreign table */
/*
* System columns other than ctid and oid should not be
* sent to the remote, since we don't make any effort to
* ensure that local and remote values match (tableoid, in
* System columns other than ctid should not be sent to
* the remote, since we don't make any effort to ensure
* that local and remote values match (tableoid, in
* particular, almost certainly doesn't match).
*/
if (var->varattno < 0 &&
var->varattno != SelfItemPointerAttributeNumber &&
var->varattno != ObjectIdAttributeNumber)
var->varattno != SelfItemPointerAttributeNumber)
return false;
/* Else check the collation */
......@@ -1145,8 +1144,8 @@ deparseTargetList(StringInfo buf,
}
/*
* Add ctid and oid if needed. We currently don't support retrieving any
* other system columns.
* Add ctid if needed. We currently don't support retrieving any other
* system columns.
*/
if (bms_is_member(SelfItemPointerAttributeNumber - FirstLowInvalidHeapAttributeNumber,
attrs_used))
......@@ -1164,22 +1163,6 @@ deparseTargetList(StringInfo buf,
*retrieved_attrs = lappend_int(*retrieved_attrs,
SelfItemPointerAttributeNumber);
}
if (bms_is_member(ObjectIdAttributeNumber - FirstLowInvalidHeapAttributeNumber,
attrs_used))
{
if (!first)
appendStringInfoString(buf, ", ");
else if (is_returning)
appendStringInfoString(buf, " RETURNING ");
first = false;
if (qualify_col)
ADD_REL_QUALIFIER(buf, rtindex);
appendStringInfoString(buf, "oid");
*retrieved_attrs = lappend_int(*retrieved_attrs,
ObjectIdAttributeNumber);
}
/* Don't generate bad syntax if no undropped columns */
if (first && !is_returning)
......@@ -2079,12 +2062,6 @@ deparseColumnRef(StringInfo buf, int varno, int varattno, RangeTblEntry *rte,
ADD_REL_QUALIFIER(buf, varno);
appendStringInfoString(buf, "ctid");
}
else if (varattno == ObjectIdAttributeNumber)
{
if (qualify_col)
ADD_REL_QUALIFIER(buf, varno);
appendStringInfoString(buf, "oid");
}
else if (varattno < 0)
{
/*
......
......@@ -129,13 +129,6 @@ CREATE FOREIGN TABLE ft6 (
c2 int NOT NULL,
c3 text
) SERVER loopback2 OPTIONS (schema_name 'S 1', table_name 'T 4');
-- A table with oids. CREATE FOREIGN TABLE doesn't support the
-- WITH OIDS option, but ALTER does.
CREATE FOREIGN TABLE ft_pg_type (
typname name,
typlen smallint
) SERVER loopback OPTIONS (schema_name 'pg_catalog', table_name 'pg_type');
ALTER TABLE ft_pg_type SET WITH OIDS;
-- ===================================================================
-- tests for validator
-- ===================================================================
......@@ -185,16 +178,15 @@ ALTER FOREIGN TABLE ft2 OPTIONS (schema_name 'S 1', table_name 'T 1');
ALTER FOREIGN TABLE ft1 ALTER COLUMN c1 OPTIONS (column_name 'C 1');
ALTER FOREIGN TABLE ft2 ALTER COLUMN c1 OPTIONS (column_name 'C 1');
\det+
List of foreign tables
Schema | Table | Server | FDW options | Description
--------+------------+-----------+--------------------------------------------------+-------------
public | ft1 | loopback | (schema_name 'S 1', table_name 'T 1') |
public | ft2 | loopback | (schema_name 'S 1', table_name 'T 1') |
public | ft4 | loopback | (schema_name 'S 1', table_name 'T 3') |
public | ft5 | loopback | (schema_name 'S 1', table_name 'T 4') |
public | ft6 | loopback2 | (schema_name 'S 1', table_name 'T 4') |
public | ft_pg_type | loopback | (schema_name 'pg_catalog', table_name 'pg_type') |
(6 rows)
List of foreign tables
Schema | Table | Server | FDW options | Description
--------+-------+-----------+---------------------------------------+-------------
public | ft1 | loopback | (schema_name 'S 1', table_name 'T 1') |
public | ft2 | loopback | (schema_name 'S 1', table_name 'T 1') |
public | ft4 | loopback | (schema_name 'S 1', table_name 'T 3') |
public | ft5 | loopback | (schema_name 'S 1', table_name 'T 4') |
public | ft6 | loopback2 | (schema_name 'S 1', table_name 'T 4') |
(5 rows)
-- Test that alteration of server options causes reconnection
-- Remote's errors might be non-English, so hide them to ensure stable results
......@@ -4048,21 +4040,6 @@ SELECT ctid, * FROM ft1 t1 LIMIT 1;
(0,1) | 1 | 1 | 00001 | Fri Jan 02 00:00:00 1970 PST | Fri Jan 02 00:00:00 1970 | 1 | 1 | foo
(1 row)
EXPLAIN (VERBOSE, COSTS OFF)
SELECT oid, * FROM ft_pg_type WHERE typname = 'int4';
QUERY PLAN
----------------------------------------------------------------------------------------------------
Foreign Scan on public.ft_pg_type
Output: oid, typname, typlen
Remote SQL: SELECT typname, typlen, oid FROM pg_catalog.pg_type WHERE ((typname = 'int4'::name))
(3 rows)
SELECT oid, * FROM ft_pg_type WHERE typname = 'int4';
oid | typname | typlen
-----+---------+--------
23 | int4 | 4
(1 row)
-- ===================================================================
-- used in PL/pgSQL function
-- ===================================================================
......
......@@ -3632,8 +3632,7 @@ build_remote_returning(Index rtindex, Relation rel, List *returningList)
if (IsA(var, Var) &&
var->varno == rtindex &&
var->varattno <= InvalidAttrNumber &&
var->varattno != SelfItemPointerAttributeNumber &&
var->varattno != ObjectIdAttributeNumber)
var->varattno != SelfItemPointerAttributeNumber)
continue; /* don't need it */
if (tlist_member((Expr *) var, tlist))
......@@ -3864,8 +3863,6 @@ init_returning_filter(PgFdwDirectModifyState *dmstate,
*/
if (attrno == SelfItemPointerAttributeNumber)
dmstate->ctidAttno = i;
else if (attrno == ObjectIdAttributeNumber)
dmstate->oidAttno = i;
else
Assert(false);
dmstate->hasSystemCols = true;
......@@ -3963,15 +3960,6 @@ apply_returning_filter(PgFdwDirectModifyState *dmstate,
resultTup->t_self = *ctid;
}
/* oid */
if (dmstate->oidAttno)
{
Oid oid = InvalidOid;
oid = DatumGetObjectId(old_values[dmstate->oidAttno - 1]);
HeapTupleSetOid(resultTup, oid);
}
/*
* And remaining columns
*
......@@ -5556,7 +5544,6 @@ make_tuple_from_result_row(PGresult *res,
Datum *values;
bool *nulls;
ItemPointer ctid = NULL;
Oid oid = InvalidOid;
ConversionLocation errpos;
ErrorContextCallback errcallback;
MemoryContext oldcontext;
......@@ -5639,17 +5626,6 @@ make_tuple_from_result_row(PGresult *res,
ctid = (ItemPointer) DatumGetPointer(datum);
}
}
else if (i == ObjectIdAttributeNumber)
{
/* oid */
if (valstr != NULL)
{
Datum datum;
datum = DirectFunctionCall1(oidin, CStringGetDatum(valstr));
oid = DatumGetObjectId(datum);
}
}
errpos.cur_attno = 0;
j++;
......@@ -5693,12 +5669,6 @@ make_tuple_from_result_row(PGresult *res,
HeapTupleHeaderSetXmin(tuple->t_data, InvalidTransactionId);
HeapTupleHeaderSetCmin(tuple->t_data, InvalidTransactionId);
/*
* If we have an OID to return, install it.
*/
if (OidIsValid(oid))
HeapTupleSetOid(tuple, oid);
/* Clean up */
MemoryContextReset(temp_context);
......@@ -5727,8 +5697,6 @@ conversion_error_callback(void *arg)
attname = NameStr(attr->attname);
else if (errpos->cur_attno == SelfItemPointerAttributeNumber)
attname = "ctid";
else if (errpos->cur_attno == ObjectIdAttributeNumber)
attname = "oid";
relname = RelationGetRelationName(errpos->rel);
}
......
......@@ -142,14 +142,6 @@ CREATE FOREIGN TABLE ft6 (
c3 text
) SERVER loopback2 OPTIONS (schema_name 'S 1', table_name 'T 4');
-- A table with oids. CREATE FOREIGN TABLE doesn't support the
-- WITH OIDS option, but ALTER does.
CREATE FOREIGN TABLE ft_pg_type (
typname name,
typlen smallint
) SERVER loopback OPTIONS (schema_name 'pg_catalog', table_name 'pg_type');
ALTER TABLE ft_pg_type SET WITH OIDS;
-- ===================================================================
-- tests for validator
-- ===================================================================
......@@ -1002,9 +994,6 @@ SELECT * FROM ft1 t1 WHERE t1.ctid = '(0,2)';
EXPLAIN (VERBOSE, COSTS OFF)
SELECT ctid, * FROM ft1 t1 LIMIT 1;
SELECT ctid, * FROM ft1 t1 LIMIT 1;
EXPLAIN (VERBOSE, COSTS OFF)
SELECT oid, * FROM ft_pg_type WHERE typname = 'int4';
SELECT oid, * FROM ft_pg_type WHERE typname = 'int4';
-- ===================================================================
-- used in PL/pgSQL function
......
......@@ -212,16 +212,6 @@ ALTER TABLE regtest_table ENABLE TRIGGER regtest_test_trig; -- not supported
CREATE RULE regtest_test_rule AS ON INSERT TO regtest_table_3 DO ALSO NOTHING;
ALTER TABLE regtest_table_3 DISABLE RULE regtest_test_rule; -- not supported
ALTER TABLE regtest_table_3 ENABLE RULE regtest_test_rule; -- not supported
ALTER TABLE regtest_table SET WITH OIDS;
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table.oid"
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.oid"
ALTER TABLE regtest_table SET WITHOUT OIDS;
LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.oid"
LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table.oid"
ALTER TABLE regtest_table SET (fillfactor = 75);
LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table"
ALTER TABLE regtest_table RESET (fillfactor);
LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema_2.regtest_table"
ALTER TABLE regtest_table_2 NO INHERIT regtest_table; -- not supported
ALTER TABLE regtest_table_2 INHERIT regtest_table; -- not supported
ALTER TABLE regtest_table SET TABLESPACE pg_default;
......@@ -265,14 +255,6 @@ LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_re
LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.p"
ALTER TABLE regtest_ptable ADD CONSTRAINT test_ck CHECK (p like '%abc%') NOT VALID; -- not supported by sepgsql
ALTER TABLE regtest_ptable DROP CONSTRAINT test_ck; -- not supported by sepgsql
ALTER TABLE regtest_ptable SET WITH OIDS;
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.oid"
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.oid"
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.oid"
ALTER TABLE regtest_ptable SET WITHOUT OIDS;
LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_table_part.oid"
LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_1_tens.oid"
LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema_2.regtest_ptable.oid"
ALTER TABLE regtest_ptable SET TABLESPACE pg_default;
-- partitioned table child
ALTER TABLE regtest_table_part ALTER p SET DEFAULT 'abcd'; -- not supported by sepgsql
......
......@@ -61,9 +61,9 @@ LINE 1: ALTER TABLE regtest_table ADD COLUMN z int;
^
LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog"
LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.z"
CREATE TABLE regtest_table_2 (a int) WITH OIDS;
CREATE TABLE regtest_table_2 (a int);
LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog"
LINE 1: CREATE TABLE regtest_table_2 (a int) WITH OIDS;
LINE 1: CREATE TABLE regtest_table_2 (a int);
^
LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog"
LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema"
......@@ -413,8 +413,6 @@ LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsq
LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_view"
ALTER TABLE regtest_table DROP COLUMN y;
LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.y"
ALTER TABLE regtest_table_2 SET WITHOUT OIDS;
LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.oid"
ALTER TABLE regtest_ptable DROP COLUMN q CASCADE;
LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.q"
LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.q"
......
......@@ -758,7 +758,7 @@ exec_object_restorecon(struct selabel_handle *sehnd, Oid catalogId)
NULL, NULL, NULL);
object.classId =</