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'
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;
* 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;
* 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);
/*
* 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",
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",
*/
ExecClearTuple(slot);
found = NextCopyFrom(festate->cstate, NULL,
- slot->tts_values, slot->tts_isnull,
- NULL);
+ slot->tts_values, slot->tts_isnull);
if (found)
ExecStoreVirtualTuple(slot);
MemoryContextReset(tupcontext);
MemoryContextSwitchTo(tupcontext);
- found = NextCopyFrom(cstate, NULL, values, nulls, NULL);
+ found = NextCopyFrom(cstate, NULL, values, nulls);
MemoryContextSwitchTo(oldcontext);
#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
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;
}
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",
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);
++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);
/* 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 */
}
/*
- * 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))
*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)
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)
{
/*
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
-- ===================================================================
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
(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
-- ===================================================================
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))
*/
if (attrno == SelfItemPointerAttributeNumber)
dmstate->ctidAttno = i;
- else if (attrno == ObjectIdAttributeNumber)
- dmstate->oidAttno = i;
else
Assert(false);
dmstate->hasSystemCols = true;
resultTup->t_self = *ctid;
}
- /* oid */
- if (dmstate->oidAttno)
- {
- Oid oid = InvalidOid;
-
- oid = DatumGetObjectId(old_values[dmstate->oidAttno - 1]);
- HeapTupleSetOid(resultTup, oid);
- }
-
/*
* And remaining columns
*
Datum *values;
bool *nulls;
ItemPointer ctid = NULL;
- Oid oid = InvalidOid;
ConversionLocation errpos;
ErrorContextCallback errcallback;
MemoryContext oldcontext;
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++;
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);
attname = NameStr(attr->attname);
else if (errpos->cur_attno == SelfItemPointerAttributeNumber)
attname = "ctid";
- else if (errpos->cur_attno == ObjectIdAttributeNumber)
- attname = "oid";
relname = RelationGetRelationName(errpos->rel);
}
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
-- ===================================================================
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
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;
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
^
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"
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"
NULL, NULL, NULL);
object.classId = DatabaseRelationId;
- object.objectId = HeapTupleGetOid(tuple);
+ object.objectId = datForm->oid;
object.objectSubId = 0;
break;
NULL, NULL);
object.classId = NamespaceRelationId;
- object.objectId = HeapTupleGetOid(tuple);
+ object.objectId = nspForm->oid;
object.objectSubId = 0;
break;
pfree(namespace_name);
object.classId = RelationRelationId;
- object.objectId = HeapTupleGetOid(tuple);
+ object.objectId = relForm->oid;
object.objectSubId = 0;
break;
pfree(namespace_name);
object.classId = ProcedureRelationId;
- object.objectId = HeapTupleGetOid(tuple);
+ object.objectId = proForm->oid;
object.objectSubId = 0;
break;
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;
-ALTER TABLE regtest_table SET WITHOUT OIDS;
ALTER TABLE regtest_table SET (fillfactor = 75);
ALTER TABLE regtest_table RESET (fillfactor);
ALTER TABLE regtest_table_2 NO INHERIT regtest_table; -- not supported
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;
-ALTER TABLE regtest_ptable SET WITHOUT OIDS;
ALTER TABLE regtest_ptable SET TABLESPACE pg_default;
-- partitioned table child
ALTER TABLE regtest_table ADD COLUMN z int;
-CREATE TABLE regtest_table_2 (a int) WITH OIDS;
+CREATE TABLE regtest_table_2 (a int);
CREATE TABLE regtest_ptable (a int) PARTITION BY RANGE (a);
CREATE TABLE regtest_ptable_ones PARTITION OF regtest_ptable FOR VALUES FROM ('0') TO ('10');
DROP VIEW regtest_view;
ALTER TABLE regtest_table DROP COLUMN y;
-ALTER TABLE regtest_table_2 SET WITHOUT OIDS;
ALTER TABLE regtest_ptable DROP COLUMN q CASCADE;
tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
{
int natt;
- Oid oid;
-
- /* print oid of tuple, it's not included in the TupleDesc */
- if ((oid = HeapTupleHeaderGetOid(tuple->t_data)) != InvalidOid)
- {
- appendStringInfo(s, " oid[oid]:%u", oid);
- }
/* print all columns individually */
for (natt = 0; natt < tupdesc->natts; natt++)
#include "postgres.h"
#include "catalog/namespace.h"
+#include "catalog/pg_ts_dict.h"
#include "commands/defrem.h"
#include "lib/stringinfo.h"
#include "tsearch/ts_cache.h"
Oid procnspid = get_func_namespace(fcinfo->flinfo->fn_oid);
const char *dictname = "unaccent";
- dictOid = GetSysCacheOid2(TSDICTNAMENSP,
+ dictOid = GetSysCacheOid2(TSDICTNAMENSP, Anum_pg_ts_dict_oid,
PointerGetDatum(dictname),
ObjectIdGetDatum(procnspid));
if (!OidIsValid(dictOid))
The <literal>CATALOG</literal> line can also be annotated, with some
other BKI property macros described in <filename>genbki.h</filename>, to
define other properties of the catalog as a whole, such as whether
- it has OIDs (by default, it does).
+ it is a shared relation.
</para>
<para>
also needed if the row's OID must be referenced from C code.
If neither case applies, the <literal>oid</literal> metadata field can
be omitted, in which case the bootstrap code assigns an OID
- automatically, or leaves it zero in a catalog that has no OIDs.
+ automatically.
In practice we usually preassign OIDs for all or none of the pre-loaded
rows in a given catalog, even if only some of them are actually
cross-referenced.
through the catalog headers and <filename>.dat</filename> files
to see which ones do not appear. You can also use
the <filename>duplicate_oids</filename> script to check for mistakes.
- (<filename>genbki.pl</filename> will also detect duplicate OIDs
+ (<filename>genbki.pl</filename> will assign OIDs for any rows that
+ didn't get one hand-assigned to them and also detect duplicate OIDs
at compile time.)
</para>
<para>
The OID counter starts at 10000 at the beginning of a bootstrap run.
- If a catalog row is in a table that requires OIDs, but no OID was
- preassigned by an <literal>oid</literal> field, then it will
- receive an OID of 10000 or above.
+ If a row from a source other than <filename>postgres.bki</filename>
+ is inserted into a table that requires OIDs, then it will receive an
+ OID of 10000 or above.
</para>
</sect2>
<replaceable class="parameter">tableoid</replaceable>
<optional><literal>bootstrap</literal></optional>
<optional><literal>shared_relation</literal></optional>
- <optional><literal>without_oids</literal></optional>
<optional><literal>rowtype_oid</literal> <replaceable>oid</replaceable></optional>
(<replaceable class="parameter">name1</replaceable> =
<replaceable class="parameter">type1</replaceable>
<para>
The table is created as shared if <literal>shared_relation</literal> is
specified.
- It will have OIDs unless <literal>without_oids</literal> is specified.
The table's row type OID (<structname>pg_type</structname> OID) can optionally
be specified via the <literal>rowtype_oid</literal> clause; if not specified,
an OID is automatically generated for it. (The <literal>rowtype_oid</literal>
<varlistentry>
<term>
- <literal>insert</literal> <optional><literal>OID =</literal> <replaceable class="parameter">oid_value</replaceable></optional> <literal>(</literal> <replaceable class="parameter">value1</replaceable> <replaceable class="parameter">value2</replaceable> ... <literal>)</literal>
+ <literal>insert</literal> <literal>(</literal> <optional><replaceable class="parameter">oid_value</replaceable></optional> <replaceable class="parameter">value1</replaceable> <replaceable class="parameter">value2</replaceable> ... <literal>)</literal>
</term>
<listitem>
Insert a new row into the open table using <replaceable
class="parameter">value1</replaceable>, <replaceable
class="parameter">value2</replaceable>, etc., for its column
- values and <replaceable
- class="parameter">oid_value</replaceable> for its OID. If
- <replaceable class="parameter">oid_value</replaceable> is zero
- (0) or the clause is omitted, and the table has OIDs, then the
- next available OID is assigned.
+ values.
</para>
<para>
<title>BKI Example</title>
<para>
- The following sequence of commands will create the
- table <literal>test_table</literal> with OID 420, having two columns
- <literal>cola</literal> and <literal>colb</literal> of type
- <type>int4</type> and <type>text</type>, respectively, and insert
- two rows into the table:
+ The following sequence of commands will create the table
+ <literal>test_table</literal> with OID 420, having three columns
+ <literal>oid</literal>, <literal>cola</literal> and <literal>colb</literal>
+ of type <type>oid</type>, <type>int4</type> and <type>text</type>,
+ respectively, and insert two rows into the table:
<programlisting>
-create test_table 420 (cola = int4, colb = text)
+create test_table 420 (oid = oid, cola = int4, colb = text)
open test_table
-insert OID=421 ( 1 "value1" )
-insert OID=422 ( 2 _null_ )
+insert ( 421 1 "value1" )
+insert ( 422 2 _null_ )
close test_table
</programlisting>
</para>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
</entry>
</row>
- <row>
- <entry><structfield>relhasoids</structfield></entry>
- <entry><type>bool</type></entry>
- <entry></entry>
- <entry>
- True if we generate an OID for each row of the relation
- </entry>
- </row>
-
<row>
<entry><structfield>relhasrules</structfield></entry>
<entry><type>bool</type></entry>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
<entry><structfield>oid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
- <entry>Row identifier (hidden attribute; must be explicitly selected)</entry>
+ <entry>Row identifier</entry>
</row>
<row>
</listitem>
</varlistentry>
- <varlistentry id="guc-default-with-oids" xreflabel="default_with_oids">
- <term><varname>default_with_oids</varname> (<type>boolean</type>)
- <indexterm>
- <primary><varname>default_with_oids</varname> configuration parameter</primary>
- </indexterm>
- </term>
- <listitem>
- <para>
- This controls whether <command>CREATE TABLE</command> and
- <command>CREATE TABLE AS</command> include an OID column in
- newly-created tables, if neither <literal>WITH OIDS</literal>
- nor <literal>WITHOUT OIDS</literal> is specified. It also
- determines whether OIDs will be included in tables created by
- <command>SELECT INTO</command>. The parameter is <literal>off</literal>
- by default; in <productname>PostgreSQL</productname> 8.0 and earlier, it
- was <literal>on</literal> by default.
- </para>
-
- <para>
- The use of OIDs in user tables is considered deprecated, so
- most installations should leave this variable disabled.
- Applications that require OIDs for a particular table should
- specify <literal>WITH OIDS</literal> when creating the
- table. This variable can be enabled for compatibility with old
- applications that do not follow this behavior.
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry id="guc-escape-string-warning" xreflabel="escape_string_warning">
<term><varname>escape_string_warning</varname> (<type>boolean</type>)
<indexterm><primary>strings</primary><secondary>escape warning</secondary></indexterm>
<para>
Object identifiers (OIDs) are used internally by
<productname>PostgreSQL</productname> as primary keys for various
- system tables. OIDs are not added to user-created tables, unless
- <literal>WITH OIDS</literal> is specified when the table is
- created, or the <xref linkend="guc-default-with-oids"/>
- configuration variable is enabled. Type <type>oid</type> represents
- an object identifier. There are also several alias types for
- <type>oid</type>: <type>regproc</type>, <type>regprocedure</type>,
- <type>regoper</type>, <type>regoperator</type>, <type>regclass</type>,
- <type>regtype</type>, <type>regrole</type>, <type>regnamespace</type>,
- <type>regconfig</type>, and <type>regdictionary</type>.
- <xref linkend="datatype-oid-table"/> shows an overview.
+ system tables.
+
+ Type <type>oid</type> represents an object identifier. There are also
+ several alias types for <type>oid</type>: <type>regproc</type>,
+ <type>regprocedure</type>, <type>regoper</type>, <type>regoperator</type>,
+ <type>regclass</type>, <type>regtype</type>, <type>regrole</type>,
+ <type>regnamespace</type>, <type>regconfig</type>, and
+ <type>regdictionary</type>. <xref linkend="datatype-oid-table"/> shows an
+ overview.
</para>
<para>
The <type>oid</type> type is currently implemented as an unsigned
four-byte integer. Therefore, it is not large enough to provide
database-wide uniqueness in large databases, or even in large
- individual tables. So, using a user-created table's OID column as
- a primary key is discouraged. OIDs are best used only for
- references to system tables.
+ individual tables.
</para>
<para>
</indexterm>
<variablelist>
- <varlistentry>
- <term><structfield>oid</structfield></term>
- <listitem>
- <para>
- <indexterm>
- <primary>OID</primary>
- <secondary>column</secondary>
- </indexterm>
- The object identifier (object ID) of a row. This column is only
- present if the table was created using <literal>WITH
- OIDS</literal>, or if the <xref linkend="guc-default-with-oids"/>
- configuration variable was set at the time. This column is of type
- <type>oid</type> (same name as the column); see <xref
- linkend="datatype-oid"/> for more information about the type.
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry>
<term><structfield>tableoid</structfield></term>
<listitem>
</varlistentry>
</variablelist>
- <para>
- OIDs are 32-bit quantities and are assigned from a single
- cluster-wide counter. In a large or long-lived database, it is
- possible for the counter to wrap around. Hence, it is bad
- practice to assume that OIDs are unique, unless you take steps to
- ensure that this is the case. If you need to identify the rows in
- a table, using a sequence generator is strongly recommended.
- However, OIDs can be used as well, provided that a few additional
- precautions are taken:
-
- <itemizedlist>
- <listitem>
- <para>
- A unique constraint should be created on the OID column of each
- table for which the OID will be used to identify rows. When such
- a unique constraint (or unique index) exists, the system takes
- care not to generate an OID matching an already-existing row.
- (Of course, this is only possible if the table contains fewer
- than 2<superscript>32</superscript> (4 billion) rows, and in practice the
- table size had better be much less than that, or performance
- might suffer.)
- </para>
- </listitem>
- <listitem>
- <para>
- OIDs should never be assumed to be unique across tables; use
- the combination of <structfield>tableoid</structfield> and row OID if you
- need a database-wide identifier.
- </para>
- </listitem>
- <listitem>
- <para>
- Of course, the tables in question must be created <literal>WITH
- OIDS</literal>. As of <productname>PostgreSQL</productname> 8.1,
- <literal>WITHOUT OIDS</literal> is the default.
- </para>
- </listitem>
- </itemizedlist>
- </para>
-
<para>
Transaction identifiers are also 32-bit quantities. In a
long-lived database it is possible for transaction IDs to wrap
</variablelist>
<para>
- <command>COPY</command>'s <literal>OIDS</literal> and
- <literal>FORCE_QUOTE</literal> options are currently not supported by
- <literal>file_fdw</literal>.
+ <command>COPY</command>'s <literal>FORCE_QUOTE</literal> options is
+ currently not supported by <literal>file_fdw</literal>.
</para>
<para>
<entry>the number of rows processed by the most
recent <acronym>SQL</acronym> command</entry>
</row>
- <row>
- <entry><varname>RESULT_OID</varname></entry>
- <entry><type>oid</type></entry>
- <entry>the OID of the last row inserted by the most
- recent <acronym>SQL</acronym> command (only useful after
- an <command>INSERT</command> command into a table having
- OIDs)</entry>
- </row>
<row>
<entry><literal>PG_CONTEXT</literal></entry>
<entry><type>text</type></entry>
</listitem>
</varlistentry>
- <varlistentry>
- <term>
- <function>spi_lastoid</function>
- <indexterm>
- <primary>spi_lastoid</primary>
- <secondary>in PL/Tcl</secondary>
- </indexterm>
- </term>
- <listitem>
- <para>
- Returns the OID of the row inserted by the last
- <function>spi_exec</function> or <function>spi_execp</function>, if the
- command was a single-row <command>INSERT</command> and the modified
- table contained OIDs. (If not, you get zero.)
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry>
<term><function>subtransaction</function> <replaceable>command</replaceable></term>
<listitem>
<literal>INSERT <replaceable>oid</replaceable>
<replaceable>rows</replaceable></literal>, where
<replaceable>rows</replaceable> is the number of rows
- inserted. <replaceable>oid</replaceable> is the object ID
- of the inserted row if <replaceable>rows</replaceable> is 1
- and the target table has OIDs;
- otherwise <replaceable>oid</replaceable> is 0.
+ inserted. <replaceable>oid</replaceable> used to be the object ID
+ of the inserted row if <replaceable>rows</replaceable> was 1
+ and the target table had OIDs, but OIDs system columns are
+ not supported anymore; therefore <replaceable>oid</replaceable>
+ is always 0.
</para>
<para>
ENABLE TRIGGER [ <replaceable class="parameter">trigger_name</replaceable> | ALL | USER ]
ENABLE REPLICA TRIGGER <replaceable class="parameter">trigger_name</replaceable>
ENABLE ALWAYS TRIGGER <replaceable class="parameter">trigger_name</replaceable>
- SET WITH OIDS
SET WITHOUT OIDS
INHERIT <replaceable class="parameter">parent_table</replaceable>
NO INHERIT <replaceable class="parameter">parent_table</replaceable>
</listitem>
</varlistentry>
- <varlistentry>
- <term><literal>SET WITH OIDS</literal></term>
- <listitem>
- <para>
- This form adds an <literal>oid</literal> system column to the
- table (see <xref linkend="ddl-system-columns"/>).
- It does nothing if the table already has OIDs.
- Unless the table's foreign-data wrapper supports OIDs, this column
- will simply read as zeroes.
- </para>
-
- <para>
- Note that this is not equivalent to <literal>ADD COLUMN oid oid</literal>;
- that would add a normal column that happened to be named
- <literal>oid</literal>, not a system column.
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry>
<term><literal>SET WITHOUT OIDS</literal></term>
<listitem>
<para>
- This form removes the <literal>oid</literal> system column from the
- table. This is exactly equivalent to
- <literal>DROP COLUMN oid RESTRICT</literal>,
- except that it will not complain if there is already no
- <literal>oid</literal> column.
+ Backward compatibility syntax for removing the <literal>oid</literal>
+ system column. As oid system columns cannot be added anymore, this never
+ has an effect.
</para>
</listitem>
</varlistentry>
NO FORCE ROW LEVEL SECURITY
CLUSTER ON <replaceable class="parameter">index_name</replaceable>
SET WITHOUT CLUSTER
- SET WITH OIDS
SET WITHOUT OIDS
SET TABLESPACE <replaceable class="parameter">new_tablespace</replaceable>
SET { LOGGED | UNLOGGED }
</listitem>
</varlistentry>
- <varlistentry>
- <term><literal>SET WITH OIDS</literal></term>
- <listitem>
- <para>
- This form adds an <literal>oid</literal> system column to the
- table (see <xref linkend="ddl-system-columns"/>).
- It does nothing if the table already has OIDs.
- </para>
-
- <para>
- Note that this is not equivalent to <literal>ADD COLUMN oid oid</literal>;
- that would add a normal column that happened to be named
- <literal>oid</literal>, not a system column.
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry>
<term><literal>SET WITHOUT OIDS</literal></term>
<listitem>
<para>
- This form removes the <literal>oid</literal> system column from the
- table. This is exactly equivalent to
- <literal>DROP COLUMN oid RESTRICT</literal>,
- except that it will not complain if there is already no
- <literal>oid</literal> column.
+ Backward compatibility syntax for removing the <literal>oid</literal>
+ system column. As oid system columns cannot be added anymore, this never
+ has an effect.
</para>
</listitem>
</varlistentry>
<varname>effective_io_concurrency</varname>, <varname>parallel_workers</varname>, <varname>seq_page_cost</varname>,
<varname>random_page_cost</varname>, <varname>n_distinct</varname> and <varname>n_distinct_inherited</varname>.
</para>
-
- <note>
- <para>
- While <command>CREATE TABLE</command> allows <literal>OIDS</literal> to be specified
- in the <literal>WITH (<replaceable
- class="parameter">storage_parameter</replaceable>)</literal> syntax,
- <command>ALTER TABLE</command> does not treat <literal>OIDS</literal> as a
- storage parameter. Instead use the <literal>SET WITH OIDS</literal>
- and <literal>SET WITHOUT OIDS</literal> forms to change OID status.
- </para>
- </note>
</listitem>
</varlistentry>
<phrase>where <replaceable class="parameter">option</replaceable> can be one of:</phrase>
FORMAT <replaceable class="parameter">format_name</replaceable>
- OIDS [ <replaceable class="parameter">boolean</replaceable> ]
FREEZE [ <replaceable class="parameter">boolean</replaceable> ]
DELIMITER '<replaceable class="parameter">delimiter_character</replaceable>'
NULL '<replaceable class="parameter">null_string</replaceable>'
</listitem>
</varlistentry>
- <varlistentry>
- <term><literal>OIDS</literal></term>
- <listitem>
- <para>
- Specifies copying the OID for each row. (An error is raised if
- <literal>OIDS</literal> is specified for a table that does not
- have OIDs, or in the case of copying a <replaceable
- class="parameter">query</replaceable>.)
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry>
<term><literal>FREEZE</literal></term>
<listitem>
place of columns that are null.
<command>COPY FROM</command> will raise an error if any line of the
input file contains more or fewer columns than are expected.
- If <literal>OIDS</literal> is specified, the OID is read or written as the first column,
- preceding the user data columns.
</para>
<para>
<term>Bit 16</term>
<listitem>
<para>
- if 1, OIDs are included in the data; if 0, not
+ If 1, OIDs are included in the data; if 0, not. Oid system columns
+ are not supported in <productname>PostgreSQL</productname>
+ anymore, but the format still contains the indicator.
</para>
</listitem>
</varlistentry>
<para>
If OIDs are included in the file, the OID field immediately follows the
-field-count word. It is a normal field except that it's not included
-in the field-count. In particular it has a length word — this will allow
-handling of 4-byte vs. 8-byte OIDs without too much pain, and will allow
-OIDs to be shown as null if that ever proves desirable.
+field-count word. It is a normal field except that it's not included in the
+field-count. Note that oid system columns are not supported in current
+versions of <productname>PostgreSQL</productname>.
</para>
</refsect3>
FROM { '<replaceable class="parameter">filename</replaceable>' | STDIN }
[ [ WITH ]
[ BINARY ]
- [ OIDS ]
[ DELIMITER [ AS ] '<replaceable class="parameter">delimiter</replaceable>' ]
[ NULL [ AS ] '<replaceable class="parameter">null string</replaceable>' ]
[ CSV [ HEADER ]
TO { '<replaceable class="parameter">filename</replaceable>' | STDOUT }
[ [ WITH ]
[ BINARY ]
- [ OIDS ]
[ DELIMITER [ AS ] '<replaceable class="parameter">delimiter</replaceable>' ]
[ NULL [ AS ] '<replaceable class="parameter">null string</replaceable>' ]
[ CSV [ HEADER ]
version 7.3 and is still supported:
<synopsis>
-COPY [ BINARY ] <replaceable class="parameter">table_name</replaceable> [ WITH OIDS ]
+COPY [ BINARY ] <replaceable class="parameter">table_name</replaceable>
FROM { '<replaceable class="parameter">filename</replaceable>' | STDIN }
[ [USING] DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ]
[ WITH NULL AS '<replaceable class="parameter">null string</replaceable>' ]
-COPY [ BINARY ] <replaceable class="parameter">table_name</replaceable> [ WITH OIDS ]
+COPY [ BINARY ] <replaceable class="parameter">table_name</replaceable>
TO { '<replaceable class="parameter">filename</replaceable>' | STDOUT }
[ [USING] DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ]
[ WITH NULL AS '<replaceable class="parameter">null string</replaceable>' ]
<command>CREATE TABLE AS</command>, except that it also remembers the query used
to initialize the view, so that it can be refreshed later upon demand.
A materialized view has many of the same properties as a table, but there
- is no support for temporary materialized views or automatic generation of
- OIDs.
+ is no support for temporary materialized views.
</para>
</refsect1>
endterm="sql-createtable-storage-parameters-title"/> for more
information. All parameters supported for <literal>CREATE
TABLE</literal> are also supported for <literal>CREATE MATERIALIZED
- VIEW</literal> with the exception of <literal>OIDS</literal>.
+ VIEW</literal>.
See <xref linkend="sql-createtable"/> for more information.
</para>
</listitem>
] )
[ INHERITS ( <replaceable>parent_table</replaceable> [, ... ] ) ]
[ PARTITION BY { RANGE | LIST | HASH } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ COLLATE <replaceable class="parameter">collation</replaceable> ] [ <replaceable class="parameter">opclass</replaceable> ] [, ... ] ) ]
-[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
+[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITHOUT OIDS ]
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
[ TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> ]
[, ... ]
) ]
[ PARTITION BY { RANGE | LIST | HASH } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ COLLATE <replaceable class="parameter">collation</replaceable> ] [ <replaceable class="parameter">opclass</replaceable> ] [, ... ] ) ]
-[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
+[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITHOUT OIDS ]
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
[ TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> ]
[, ... ]
) ] { FOR VALUES <replaceable class="parameter">partition_bound_spec</replaceable> | DEFAULT }
[ PARTITION BY { RANGE | LIST | HASH } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ COLLATE <replaceable class="parameter">collation</replaceable> ] [ <replaceable class="parameter">opclass</replaceable> ] [, ... ] ) ]
-[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
+[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITHOUT OIDS ]
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
[ TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> ]
<para>
A partition must have the same column names and types as the partitioned
- table to which it belongs. If the parent is specified <literal>WITH
- OIDS</literal> then all partitions must have OIDs; the parent's OID
- column will be inherited by all partitions just like any other column.
- Modifications to the column names or types of a partitioned table, or
- the addition or removal of an OID column, will automatically propagate
- to all partitions. <literal>CHECK</literal> constraints will be inherited
- automatically by every partition, but an individual partition may specify
- additional <literal>CHECK</literal> constraints; additional constraints with
- the same name and condition as in the parent will be merged with the
- parent constraint. Defaults may be specified separately for each
- partition.
+ table to which it belongs. Modifications to the column names or types of
+ a partitioned table will automatically propagate to all partitions.
+ <literal>CHECK</literal> constraints will be inherited automatically by
+ every partition, but an individual partition may specify additional
+ <literal>CHECK</literal> constraints; additional constraints with the
+ same name and condition as in the parent will be merged with the parent
+ constraint. Defaults may be specified separately for each partition.
</para>
<para>
This clause specifies optional storage parameters for a table or index;
see <xref linkend="sql-createtable-storage-parameters"
endterm="sql-createtable-storage-parameters-title"/> for more
- information. The <literal>WITH</literal> clause for a
- table can also include <literal>OIDS=TRUE</literal> (or just <literal>OIDS</literal>)
- to specify that rows of the new table
- should have OIDs (object identifiers) assigned to them, or
- <literal>OIDS=FALSE</literal> to specify that the rows should not have OIDs.
- If <literal>OIDS</literal> is not specified, the default setting depends upon
- the <xref linkend="guc-default-with-oids"/> configuration parameter.
- (If the new table inherits from any tables that have OIDs, then
- <literal>OIDS=TRUE</literal> is forced even if the command says
- <literal>OIDS=FALSE</literal>.)
- </para>
-
- <para>
- If <literal>OIDS=FALSE</literal> is specified or implied, the new
- table does not store OIDs and no OID will be assigned for a row inserted
- into it. This is generally considered worthwhile, since it
- will reduce OID consumption and thereby postpone the wraparound
- of the 32-bit OID counter. Once the counter wraps around, OIDs
- can no longer be assumed to be unique, which makes them
- considerably less useful. In addition, excluding OIDs from a
- table reduces the space required to store the table on disk by
- 4 bytes per row (on most machines), slightly improving performance.
- </para>
-
- <para>
- To remove OIDs from a table after it has been created, use <xref
- linkend="sql-altertable"/>.
+ information. For backward-compatibility the <literal>WITH</literal>
+ clause for a table can also include <literal>OIDS=FALSE</literal> to
+ specify that rows of the new table should not contain OIDs (object
+ identifiers), <literal>OIDS=TRUE</literal> is not supported anymore.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><literal>WITH OIDS</literal></term>
<term><literal>WITHOUT OIDS</literal></term>
<listitem>
<para>
- These are obsolescent syntaxes equivalent to <literal>WITH (OIDS)</literal>
- and <literal>WITH (OIDS=FALSE)</literal>, respectively. If you wish to give
- both an <literal>OIDS</literal> setting and storage parameters, you must use
- the <literal>WITH ( ... )</literal> syntax; see above.
+ This is backward-compatible syntax for declaring a table
+ <literal>WITHOUT OIDS</literal>, creating a table <literal>WITH
+ OIDS</literal> is not supported anymore.
</para>
</listitem>
</varlistentry>
<refsect1 id="sql-createtable-notes">
<title>Notes</title>
-
- <para>
- Using OIDs in new applications is not recommended: where
- possible, using an identity column or other sequence
- generator as the table's primary key is preferred. However, if
- your application does make use of OIDs to identify specific
- rows of a table, it is recommended to create a unique constraint
- on the <structfield>oid</structfield> column of that table, to ensure that
- OIDs in the table will indeed uniquely identify rows even after
- counter wraparound. Avoid assuming that OIDs are unique across
- tables; if you need a database-wide unique identifier, use the
- combination of <structfield>tableoid</structfield> and row OID for the
- purpose.
- </para>
-
- <tip>
- <para>
- The use of <literal>OIDS=FALSE</literal> is not recommended
- for tables with no primary key, since without either an OID or a
- unique data key, it is difficult to identify specific rows.
- </para>
- </tip>
-
<para>
<productname>PostgreSQL</productname> automatically creates an
index for each unique constraint and primary key constraint to
<para>
The <literal>WITH</literal> clause is a <productname>PostgreSQL</productname>
- extension; neither storage parameters nor OIDs are in the standard.
+ extension; storage parameters are not in the standard.
</para>
</refsect2>
<synopsis>
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] <replaceable>table_name</replaceable>
[ (<replaceable>column_name</replaceable> [, ...] ) ]
- [ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
+ [ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITHOUT OIDS ]
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
[ TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> ]
AS <replaceable>query</replaceable>
This clause specifies optional storage parameters for the new table;
see <xref linkend="sql-createtable-storage-parameters"
endterm="sql-createtable-storage-parameters-title"/> for more
- information. The <literal>WITH</literal> clause
- can also include <literal>OIDS=TRUE</literal> (or just <literal>OIDS</literal>)
- to specify that rows of the new table
- should have OIDs (object identifiers) assigned to them, or
- <literal>OIDS=FALSE</literal> to specify that the rows should not have OIDs.
- See <xref linkend="sql-createtable"/> for more information.
+ information. For backward-compatibility the <literal>WITH</literal>
+ clause for a table can also include <literal>OIDS=FALSE</literal> to
+ specify that rows of the new table should contain no OIDs (object
+ identifiers), <literal>OIDS=TRUE</literal> is not supported anymore.
+ OIDs.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><literal>WITH OIDS</literal></term>
<term><literal>WITHOUT OIDS</literal></term>
<listitem>
<para>
- These are obsolescent syntaxes equivalent to <literal>WITH (OIDS)</literal>
- and <literal>WITH (OIDS=FALSE)</literal>, respectively. If you wish to give
- both an <literal>OIDS</literal> setting and storage parameters, you must use
- the <literal>WITH ( ... )</literal> syntax; see above.
+ This is backward-compatible syntax for declaring a table
+ <literal>WITHOUT OIDS</literal>, creating a table <literal>WITH
+ OIDS</literal> is not supported anymore.
</para>
</listitem>
</varlistentry>
TABLE AS</command> offers a superset of the functionality offered
by <command>SELECT INTO</command>.
</para>
-
- <para>
- The <command>CREATE TABLE AS</command> command allows the user to
- explicitly specify whether OIDs should be included. If the
- presence of OIDs is not explicitly specified,
- the <xref linkend="guc-default-with-oids"/> configuration variable is
- used.
- </para>
</refsect1>
<refsect1>
<para>
Create a new temporary table <literal>films_recent</literal>, consisting of
only recent entries from the table <literal>films</literal>, using a
- prepared statement. The new table has OIDs and will be dropped at commit:
+ prepared statement. The new table will be dropped at commit:
<programlisting>
PREPARE recentfilms(date) AS
SELECT * FROM films WHERE date_prod > $1;
-CREATE TEMP TABLE films_recent WITH (OIDS) ON COMMIT DROP AS
+CREATE TEMP TABLE films_recent ON COMMIT DROP AS
EXECUTE recentfilms('2002-01-01');
</programlisting></para>
</refsect1>
<listitem>
<para>
The <literal>WITH</literal> clause is a <productname>PostgreSQL</productname>
- extension; neither storage parameters nor OIDs are in the standard.
+ extension; storage parameters are not in the standard.
</para>
</listitem>
</listitem>
</varlistentry>
- <varlistentry>
- <term><option>-o</option></term>
- <term><option>--oids</option></term>
- <listitem>
- <para>
- Dump object identifiers (<acronym>OID</acronym>s) as part of the
- data for every table. Use this option if your application references
- the <acronym>OID</acronym>
- columns in some way (e.g., in a foreign key constraint).
- Otherwise, this option should not be used.
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry>
<term><option>-O</option></term>
<term><option>--no-owner</option></term>
<command>CREATE TABLE AS</command> offers a superset of the
functionality provided by <command>SELECT INTO</command>.
</para>
-
- <para>
- To add OIDs to the table created by <command>SELECT INTO</command>,
- enable the <xref linkend="guc-default-with-oids"/> configuration
- variable. Alternatively, <command>CREATE TABLE AS</command> can be
- used with the <literal>WITH OIDS</literal> clause.
- </para>
</refsect1>
<refsect1>
<listitem>
<para>
Prevent foreign tables from being created with OIDS
- when <xref linkend="guc-default-with-oids"/> is true
+ when <literal>default_with_oids"</literal> is true
(Etsuro Fujita)
</para>
</listitem>
<listitem>
<para>
Prevent foreign tables from being created with OIDS
- when <xref linkend="guc-default-with-oids"/> is true
+ when <literal>default_with_oids"</literal> is true
(Etsuro Fujita)
</para>
</listitem>
<listitem>
<para>
Prevent foreign tables from being created with OIDS
- when <xref linkend="guc-default-with-oids"/> is true
+ when <literal>default_with_oids"</literal> is true
(Etsuro Fujita)
</para>
</listitem>
/* make sure it's in the bdesc's context */
oldcxt = MemoryContextSwitchTo(brdesc->bd_context);
- tupdesc = CreateTemplateTupleDesc(brdesc->bd_totalstored, false);
+ tupdesc = CreateTemplateTupleDesc(brdesc->bd_totalstored);
for (i = 0; i < brdesc->bd_tupdesc->natts; i++)
{
{
case TableOidAttributeNumber:
case SelfItemPointerAttributeNumber:
- case ObjectIdAttributeNumber:
case MinTransactionIdAttributeNumber:
case MinCommandIdAttributeNumber:
case MaxTransactionIdAttributeNumber:
/* pass-by-reference datatype */
result = PointerGetDatum(&(tup->t_self));
break;
- case ObjectIdAttributeNumber:
- result = ObjectIdGetDatum(HeapTupleGetOid(tup));
- break;
case MinTransactionIdAttributeNumber:
result = TransactionIdGetDatum(HeapTupleHeaderGetRawXmin(tup->t_data));
break;
else
targetNullLen = 0;
- if (tupleDesc->tdhasoid)
- len += sizeof(Oid);
-
/*
* Allocate and zero the space needed. Note that the tuple body and
* HeapTupleData management structure are allocated in one chunk.
if (hasnull)
len += BITMAPLEN(numberOfAttributes);
- if (tupleDescriptor->tdhasoid)
- len += sizeof(Oid);
-
hoff = len = MAXALIGN(len); /* align user data safely */
data_len = heap_compute_data_size(tupleDescriptor, values, isnull);
HeapTupleHeaderSetNatts(td, numberOfAttributes);
td->t_hoff = hoff;
- if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */
- td->t_infomask = HEAP_HASOID;
-
heap_fill_tuple(tupleDescriptor,
values,
isnull,
pfree(isnull);
/*
- * copy the identification info of the old tuple: t_ctid, t_self, and OID
- * (if any)
+ * copy the identification info of the old tuple: t_ctid, t_self
*/
newTuple->t_data->t_ctid = tuple->t_data->t_ctid;
newTuple->t_self = tuple->t_self;
newTuple->t_tableOid = tuple->t_tableOid;
- if (tupleDesc->tdhasoid)
- HeapTupleSetOid(newTuple, HeapTupleGetOid(tuple));
return newTuple;
}
pfree(isnull);
/*
- * copy the identification info of the old tuple: t_ctid, t_self, and OID
- * (if any)
+ * copy the identification info of the old tuple: t_ctid, t_self
*/
newTuple->t_data->t_ctid = tuple->t_data->t_ctid;
newTuple->t_self = tuple->t_self;
newTuple->t_tableOid = tuple->t_tableOid;
- if (tupleDesc->tdhasoid)
- HeapTupleSetOid(newTuple, HeapTupleGetOid(tuple));
return newTuple;
}
if (hasnull)
len += BITMAPLEN(numberOfAttributes);
- if (tupleDescriptor->tdhasoid)
- len += sizeof(Oid);
-
hoff = len = MAXALIGN(len); /* align user data safely */
data_len = heap_compute_data_size(tupleDescriptor, values, isnull);
HeapTupleHeaderSetNatts(tuple, numberOfAttributes);
tuple->t_hoff = hoff + MINIMAL_TUPLE_OFFSET;
- if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */
- tuple->t_infomask = HEAP_HASOID;
-
heap_fill_tuple(tupleDescriptor,
values,
isnull,
* reloptions value (possibly NULL), and we replace or remove entries
* as needed.
*
- * If ignoreOids is true, then we should ignore any occurrence of "oids"
- * in the list (it will be or has been handled by interpretOidsOption()).
+ * If acceptOidsOff is true, then we allow oids = false, but throw error when
+ * on. This is solely needed for backwards compatibility.
*
* Note that this is not responsible for determining whether the options
* are valid, but it does check that namespaces for all the options given are
*/
Datum
transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
- char *validnsps[], bool ignoreOids, bool isReset)
+ char *validnsps[], bool acceptOidsOff, bool isReset)
{
Datum result;
ArrayBuildState *astate;
def->defnamespace)));
}
- if (ignoreOids && strcmp(def->defname, "oids") == 0)
- continue;
-
/* ignore if not in the same namespace */
if (namspace == NULL)
{
value = defGetString(def);
else
value = "true";
+
+ /*
+ * This is not a great place for this test, but there's no other
+ * convenient place to filter the option out. As WITH (oids =
+ * false) will be removed someday, this seems like an acceptable
+ * amount of ugly.
+ */
+ if (acceptOidsOff && def->defnamespace == NULL &&
+ strcmp(def->defname, "oids") == 0)
+ {
+ if (defGetBoolean(def))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("tables declared WITH OIDS are not supported")));
+ /* skip over option, reloptions machinery doesn't know it */
+ continue;
+ }
+
len = VARHDRSZ + strlen(def->defname) + 1 + strlen(value);
/* +1 leaves room for sprintf's trailing null */
t = (text *) palloc(len + 1);
/*
* Check to see if the map is one-to-one, in which case we need not do a
- * tuple conversion. We must also insist that both tupdescs either
- * specify or don't specify an OID column, else we need a conversion to
- * add/remove space for that. (For some callers, presence or absence of
- * an OID column perhaps would not really matter, but let's be safe.)
+ * tuple conversion.
*/
- if (indesc->natts == outdesc->natts &&
- indesc->tdhasoid == outdesc->tdhasoid)
+ if (indesc->natts == outdesc->natts)
{
for (i = 0; i < n; i++)
{
/*
* Check to see if the map is one-to-one, in which case we need not do a
- * tuple conversion. We must also insist that both tupdescs either
- * specify or don't specify an OID column, else we need a conversion to
- * add/remove space for that. (For some callers, presence or absence of
- * an OID column perhaps would not really matter, but let's be safe.)
+ * tuple conversion.
*/
- if (indesc->natts == outdesc->natts &&
- indesc->tdhasoid == outdesc->tdhasoid)
+ if (indesc->natts == outdesc->natts)
{
same = true;
for (i = 0; i < n; i++)
* caller can overwrite this if needed.
*/
TupleDesc
-CreateTemplateTupleDesc(int natts, bool hasoid)
+CreateTemplateTupleDesc(int natts)
{
TupleDesc desc;
desc->constr = NULL;
desc->tdtypeid = RECORDOID;
desc->tdtypmod = -1;
- desc->tdhasoid = hasoid;
desc->tdrefcount = -1; /* assume not reference-counted */
return desc;
* caller can overwrite this if needed.
*/
TupleDesc
-CreateTupleDesc(int natts, bool hasoid, Form_pg_attribute *attrs)
+CreateTupleDesc(int natts, Form_pg_attribute *attrs)
{
TupleDesc desc;
int i;
- desc = CreateTemplateTupleDesc(natts, hasoid);
+ desc = CreateTemplateTupleDesc(natts);
for (i = 0; i < natts; ++i)
memcpy(TupleDescAttr(desc, i), attrs[i], ATTRIBUTE_FIXED_PART_SIZE);
TupleDesc desc;
int i;
- desc = CreateTemplateTupleDesc(tupdesc->natts, tupdesc->tdhasoid);
+ desc = CreateTemplateTupleDesc(tupdesc->natts);
/* Flat-copy the attribute array */
memcpy(TupleDescAttr(desc, 0),
TupleConstr *constr = tupdesc->constr;
int i;
- desc = CreateTemplateTupleDesc(tupdesc->natts, tupdesc->tdhasoid);
+ desc = CreateTemplateTupleDesc(tupdesc->natts);
/* Flat-copy the attribute array */
memcpy(TupleDescAttr(desc, 0),
return false;
if (tupdesc1->tdtypeid != tupdesc2->tdtypeid)
return false;
- if (tupdesc1->tdhasoid != tupdesc2->tdhasoid)
- return false;
for (i = 0; i < tupdesc1->natts; i++)
{
s = hash_combine(0, hash_uint32(desc->natts));
s = hash_combine(s, hash_uint32(desc->tdtypeid));
- s = hash_combine(s, hash_uint32(desc->tdhasoid));
for (i = 0; i < desc->natts; ++i)
s = hash_combine(s, hash_uint32(TupleDescAttr(desc, i)->atttypid));
* allocate a new tuple descriptor
*/
natts = list_length(schema);
- desc = CreateTemplateTupleDesc(natts, false);
+ desc = CreateTemplateTupleDesc(natts);
has_not_null = false;
attnum = 0;
/*
* allocate a new tuple descriptor
*/
- desc = CreateTemplateTupleDesc(natts, false);
+ desc = CreateTemplateTupleDesc(natts);
attnum = 0;
state->tupdesc[i] = state->origTupdesc;
else
{
- state->tupdesc[i] = CreateTemplateTupleDesc(2, false);
+ state->tupdesc[i] = CreateTemplateTupleDesc(2);
TupleDescInitEntry(state->tupdesc[i], (AttrNumber) 1, NULL,
INT2OID, -1, 0);
* types.
*/
natts = RelationGetNumberOfAttributes(scan->indexRelation);
- so->giststate->fetchTupdesc = CreateTemplateTupleDesc(natts, false);
+ so->giststate->fetchTupdesc = CreateTemplateTupleDesc(natts);
for (attno = 1; attno <= natts; attno++)
{
TupleDescInitEntry(so->giststate->fetchTupdesc, attno, NULL,
* TID where the tuple was stored. But note that any toasting of fields
* within the tuple data is NOT reflected into *tup.
*/
-Oid
+void
heap_insert(Relation relation, HeapTuple tup, CommandId cid,
int options, BulkInsertState bistate)
{
tup->t_self = heaptup->t_self;
heap_freetuple(heaptup);
}
-
- return HeapTupleGetOid(tup);
}
/*
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
errmsg("cannot insert tuples in a parallel worker")));
- if (relation->rd_rel->relhasoids)
- {
-#ifdef NOT_USED
- /* this is redundant with an Assert in HeapTupleSetOid */
- Assert(tup->t_data->t_infomask & HEAP_HASOID);
-#endif
-
- /*
- * If the object id of this tuple has already been assigned, trust the
- * caller. There are a couple of ways this can happen. At initial db
- * creation, the backend program sets oids for tuples. When we define
- * an index, we set the oid. Finally, in the future, we may allow
- * users to set their own object ids in order to support a persistent
- * object store (objects need to contain pointers to one another).
- */
- if (!OidIsValid(HeapTupleGetOid(tup)))
- HeapTupleSetOid(tup, GetNewOid(relation));
- }
- else
- {
- /* check there is not space for an OID */
- Assert(!(tup->t_data->t_infomask & HEAP_HASOID));
- }
-
tup->t_data->t_infomask &= ~(HEAP_XACT_MASK);
tup->t_data->t_infomask2 &= ~(HEAP2_XACT_MASK);
tup->t_data->t_infomask |= HEAP_XMAX_INVALID;
* This should be used rather than using heap_insert directly in most places
* where we are modifying system catalogs.
*/
-Oid
+void
simple_heap_insert(Relation relation, HeapTuple tup)
{
- return heap_insert(relation, tup, GetCurrentCommandId(true), 0, NULL);
+ heap_insert(relation, tup, GetCurrentCommandId(true), 0, NULL);
}
/*
/* the new tuple is ready, except for this: */
newtup->t_tableOid = RelationGetRelid(relation);
- /* Fill in OID for newtup */
- if (relation->rd_rel->relhasoids)
- {
-#ifdef NOT_USED
- /* this is redundant with an Assert in HeapTupleSetOid */
- Assert(newtup->t_data->t_infomask & HEAP_HASOID);
-#endif
- HeapTupleSetOid(newtup, HeapTupleGetOid(&oldtup));
- }
- else
- {
- /* check there is not space for an OID */
- Assert(!(newtup->t_data->t_infomask & HEAP_HASOID));
- }
-
/* Determine columns modified by the update. */
modified_attrs = HeapDetermineModifiedColumns(relation, interesting_attrs,
&oldtup, newtup);
/*
* Likewise, automatically say "not equal" for any system attribute other
- * than OID and tableOID; we cannot expect these to be consistent in a HOT
- * chain, or even to be set correctly yet in the new tuple.
+ * than tableOID; we cannot expect these to be consistent in a HOT chain,
+ * or even to be set correctly yet in the new tuple.
*/
if (attrnum < 0)
{
- if (attrnum != ObjectIdAttributeNumber &&
- attrnum != TableOidAttributeNumber)
+ if (attrnum != TableOidAttributeNumber)
return false;
}
int attno = idx_rel->rd_index->indkey.values[natt];
if (attno < 0)
- {
- /*
- * The OID column can appear in an index definition, but that's
- * OK, because we always copy the OID if present (see below).
- * Other system columns may not.
- */
- if (attno == ObjectIdAttributeNumber)
- continue;
elog(ERROR, "system column in index");
- }
nulls[attno - 1] = false;
}
*copy = true;
RelationClose(idx_rel);
- /*
- * Always copy oids if the table has them, even if not included in the
- * index. The space in the logged tuple is used anyway, so there's little
- * point in not including the information.
- */
- if (relation->rd_rel->relhasoids)
- HeapTupleSetOid(key_tuple, HeapTupleGetOid(tp));
-
/*
* If the tuple, which by here only contains indexed columns, still has
* toasted columns, force them to be inlined. This is somewhat unlikely
hoff = SizeofHeapTupleHeader;
if (has_nulls)
hoff += BITMAPLEN(numAttrs);
- if (newtup->t_data->t_infomask & HEAP_HASOID)
- hoff += sizeof(Oid);
hoff = MAXALIGN(hoff);
/* now convert to a limit on the tuple data size */
maxDataLen = RelationGetToastTupleTarget(rel, TOAST_TUPLE_TARGET) - hoff;
new_header_len = SizeofHeapTupleHeader;
if (has_nulls)
new_header_len += BITMAPLEN(numAttrs);
- if (olddata->t_infomask & HEAP_HASOID)
- new_header_len += sizeof(Oid);
new_header_len = MAXALIGN(new_header_len);
new_data_len = heap_compute_data_size(tupleDesc,
toast_values, toast_isnull);
memcpy(new_data, olddata, SizeofHeapTupleHeader);
HeapTupleHeaderSetNatts(new_data, numAttrs);
new_data->t_hoff = new_header_len;
- if (olddata->t_infomask & HEAP_HASOID)
- HeapTupleHeaderSetOid(new_data, HeapTupleHeaderGetOid(olddata));
/* Copy over the data, and fill the null bitmap if needed */
heap_fill_tuple(tupleDesc,
new_tuple = heap_form_tuple(tupleDesc, toast_values, toast_isnull);
/*
- * Be sure to copy the tuple's OID and identity fields. We also make a
- * point of copying visibility info, just in case anybody looks at those
- * fields in a syscache entry.
+ * Be sure to copy the tuple's identity fields. We also make a point of
+ * copying visibility info, just in case anybody looks at those fields in
+ * a syscache entry.
*/
- if (tupleDesc->tdhasoid)
- HeapTupleSetOid(new_tuple, HeapTupleGetOid(tup));
-
new_tuple->t_self = tup->t_self;
new_tuple->t_tableOid = tup->t_tableOid;
new_header_len = SizeofHeapTupleHeader;
if (has_nulls)
new_header_len += BITMAPLEN(numAttrs);
- if (tup->t_infomask & HEAP_HASOID)
- new_header_len += sizeof(Oid);
new_header_len = MAXALIGN(new_header_len);
new_data_len = heap_compute_data_size(tupleDesc,
toast_values, toast_isnull);
memcpy(new_data, tup, SizeofHeapTupleHeader);
HeapTupleHeaderSetNatts(new_data, numAttrs);
new_data->t_hoff = new_header_len;
- if (tup->t_infomask & HEAP_HASOID)
- HeapTupleHeaderSetOid(new_data, HeapTupleHeaderGetOid(tup));
/* Set the composite-Datum header fields correctly */
HeapTupleHeaderSetDatumLength(new_data, new_tuple_len);
*
* Test whether a toast value with the given ID exists in the toast relation.
* For safety, we consider a value to exist if there are either live or dead
- * toast rows with that ID; see notes for GetNewOid().
+ * toast rows with that ID; see notes for GetNewOidWithIndex().
* ----------
*/
static bool
* Construct a tuple descriptor for the result row. This must match this
* function's pg_proc entry!
*/
- tupdesc = CreateTemplateTupleDesc(2, false);
+ tupdesc = CreateTemplateTupleDesc(2);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "xid",
XIDOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "timestamp",
false);
multi->iter = 0;
- tupdesc = CreateTemplateTupleDesc(2, false);
+ tupdesc = CreateTemplateTupleDesc(2);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "xid",
XIDOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "mode",
/* build tupdesc for result tuples */
/* this had better match pg_prepared_xacts view in system_views.sql */
- tupdesc = CreateTemplateTupleDesc(5, false);
+ tupdesc = CreateTemplateTupleDesc(5);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "transaction",
XIDOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "gid",
* OIDs are generated by a cluster-wide counter. Since they are only 32 bits
* wide, counter wraparound will occur eventually, and therefore it is unwise
* to assume they are unique unless precautions are taken to make them so.
- * Hence, this routine should generally not be used directly. The only
- * direct callers should be GetNewOid() and GetNewRelFileNode() in
+ * Hence, this routine should generally not be used directly. The only direct
+ * callers should be GetNewOidWithIndex() and GetNewRelFileNode() in
* catalog/catalog.c.
*/
Oid
* Construct a tuple descriptor for the result row. This must match this
* function's pg_proc entry!
*/
- resultTupleDesc = CreateTemplateTupleDesc(2, false);
+ resultTupleDesc = CreateTemplateTupleDesc(2);
TupleDescInitEntry(resultTupleDesc, (AttrNumber) 1, "file_name",
TEXTOID, -1, 0);
TupleDescInitEntry(resultTupleDesc, (AttrNumber) 2, "file_offset",
%type <list> boot_index_params
%type <ielem> boot_index_param
%type <str> boot_ident
-%type <ival> optbootstrap optsharedrelation optwithoutoids boot_column_nullness
-%type <oidval> oidspec optoideq optrowtypeoid
+%type <ival> optbootstrap optsharedrelation boot_column_nullness
+%type <oidval> oidspec optrowtypeoid
%token <str> ID
%token COMMA EQUALS LPAREN RPAREN
/* All the rest are unreserved, and should be handled in boot_ident! */
%token <kw> OPEN XCLOSE XCREATE INSERT_TUPLE
%token <kw> XDECLARE INDEX ON USING XBUILD INDICES UNIQUE XTOAST
-%token <kw> OBJ_ID XBOOTSTRAP XSHARED_RELATION XWITHOUT_OIDS XROWTYPE_OID
+%token <kw> OBJ_ID XBOOTSTRAP XSHARED_RELATION XROWTYPE_OID
%token <kw> XFORCE XNOT XNULL
%start TopLevel
;
Boot_CreateStmt:
- XCREATE boot_ident oidspec optbootstrap optsharedrelation optwithoutoids optrowtypeoid LPAREN
+ XCREATE boot_ident oidspec optbootstrap optsharedrelation optrowtypeoid LPAREN
{
do_start();
numattr = 0;
do_start();
- tupdesc = CreateTupleDesc(numattr, !($6), attrtypes);
+ tupdesc = CreateTupleDesc(numattr, attrtypes);
shared_relation = $5;
PG_CATALOG_NAMESPACE,
shared_relation ? GLOBALTABLESPACE_OID : 0,
$3,
- $7,
+ $6,
InvalidOid,
BOOTSTRAP_SUPERUSERID,
tupdesc,
RELPERSISTENCE_PERMANENT,
shared_relation,
mapped_relation,
- true,
- 0,
ONCOMMIT_NOOP,
(Datum) 0,
false,
;
Boot_InsertStmt:
- INSERT_TUPLE optoideq
+ INSERT_TUPLE
{
do_start();
- if ($2)
- elog(DEBUG4, "inserting row with oid %u", $2);
- else
- elog(DEBUG4, "inserting row");
+ &