Remove WITH OIDS support, change oid catalog column visibility.
authorAndres Freund <andres@anarazel.de>
Tue, 20 Nov 2018 23:36:57 +0000 (15:36 -0800)
committerAndres Freund <andres@anarazel.de>
Wed, 21 Nov 2018 00:00:17 +0000 (16:00 -0800)
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: http://postgr.es/m/20180930034810.ywp2c7awz7opzcfr@alap3.anarazel.de

343 files changed:
contrib/adminpack/adminpack.c
contrib/btree_gist/expected/cash.out
contrib/btree_gist/expected/oid.out
contrib/btree_gist/sql/cash.sql
contrib/btree_gist/sql/oid.sql
contrib/dblink/dblink.c
contrib/file_fdw/file_fdw.c
contrib/pageinspect/heapfuncs.c
contrib/pg_buffercache/pg_buffercache_pages.c
contrib/pg_visibility/pg_visibility.c
contrib/postgres_fdw/deparse.c
contrib/postgres_fdw/expected/postgres_fdw.out
contrib/postgres_fdw/postgres_fdw.c
contrib/postgres_fdw/sql/postgres_fdw.sql
contrib/sepgsql/expected/alter.out
contrib/sepgsql/expected/ddl.out
contrib/sepgsql/label.c
contrib/sepgsql/sql/alter.sql
contrib/sepgsql/sql/ddl.sql
contrib/test_decoding/test_decoding.c
contrib/unaccent/unaccent.c
doc/src/sgml/bki.sgml
doc/src/sgml/catalogs.sgml
doc/src/sgml/config.sgml
doc/src/sgml/datatype.sgml
doc/src/sgml/ddl.sgml
doc/src/sgml/file-fdw.sgml
doc/src/sgml/plpgsql.sgml
doc/src/sgml/pltcl.sgml
doc/src/sgml/protocol.sgml
doc/src/sgml/ref/alter_foreign_table.sgml
doc/src/sgml/ref/alter_table.sgml
doc/src/sgml/ref/copy.sgml
doc/src/sgml/ref/create_materialized_view.sgml
doc/src/sgml/ref/create_table.sgml
doc/src/sgml/ref/create_table_as.sgml
doc/src/sgml/ref/pg_dump.sgml
doc/src/sgml/ref/select_into.sgml
doc/src/sgml/release-9.1.sgml
doc/src/sgml/release-9.2.sgml
doc/src/sgml/release-9.3.sgml
src/backend/access/brin/brin_tuple.c
src/backend/access/common/heaptuple.c
src/backend/access/common/reloptions.c
src/backend/access/common/tupconvert.c
src/backend/access/common/tupdesc.c
src/backend/access/gin/ginutil.c
src/backend/access/gist/gistscan.c
src/backend/access/heap/heapam.c
src/backend/access/heap/tuptoaster.c
src/backend/access/transam/commit_ts.c
src/backend/access/transam/multixact.c
src/backend/access/transam/twophase.c
src/backend/access/transam/varsup.c
src/backend/access/transam/xlogfuncs.c
src/backend/bootstrap/bootparse.y
src/backend/bootstrap/bootscanner.l
src/backend/bootstrap/bootstrap.c
src/backend/catalog/Catalog.pm
src/backend/catalog/aclchk.c
src/backend/catalog/catalog.c
src/backend/catalog/genbki.pl
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/indexing.c
src/backend/catalog/information_schema.sql
src/backend/catalog/namespace.c
src/backend/catalog/objectaddress.c
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_collation.c
src/backend/catalog/pg_constraint.c
src/backend/catalog/pg_conversion.c
src/backend/catalog/pg_enum.c
src/backend/catalog/pg_largeobject.c
src/backend/catalog/pg_namespace.c
src/backend/catalog/pg_operator.c
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_publication.c
src/backend/catalog/pg_subscription.c
src/backend/catalog/pg_type.c
src/backend/catalog/toasting.c
src/backend/commands/alter.c
src/backend/commands/amcmds.c
src/backend/commands/cluster.c
src/backend/commands/copy.c
src/backend/commands/createas.c
src/backend/commands/dbcommands.c
src/backend/commands/event_trigger.c
src/backend/commands/explain.c
src/backend/commands/extension.c
src/backend/commands/foreigncmds.c
src/backend/commands/functioncmds.c
src/backend/commands/indexcmds.c
src/backend/commands/matview.c
src/backend/commands/opclasscmds.c
src/backend/commands/policy.c
src/backend/commands/prepare.c
src/backend/commands/proclang.c
src/backend/commands/publicationcmds.c
src/backend/commands/schemacmds.c
src/backend/commands/sequence.c
src/backend/commands/statscmds.c
src/backend/commands/subscriptioncmds.c
src/backend/commands/tablecmds.c
src/backend/commands/tablespace.c
src/backend/commands/trigger.c
src/backend/commands/tsearchcmds.c
src/backend/commands/typecmds.c
src/backend/commands/user.c
src/backend/commands/vacuum.c
src/backend/commands/vacuumlazy.c
src/backend/commands/variable.c
src/backend/commands/view.c
src/backend/executor/execExpr.c
src/backend/executor/execJunk.c
src/backend/executor/execMain.c
src/backend/executor/execPartition.c
src/backend/executor/execSRF.c
src/backend/executor/execTuples.c
src/backend/executor/execUtils.c
src/backend/executor/functions.c
src/backend/executor/nodeAgg.c
src/backend/executor/nodeCustom.c
src/backend/executor/nodeForeignscan.c
src/backend/executor/nodeFunctionscan.c
src/backend/executor/nodeIndexonlyscan.c
src/backend/executor/nodeModifyTable.c
src/backend/executor/nodeSubplan.c
src/backend/executor/spi.c
src/backend/foreign/foreign.c
src/backend/optimizer/util/plancat.c
src/backend/parser/gram.y
src/backend/parser/parse_clause.c
src/backend/parser/parse_oper.c
src/backend/parser/parse_relation.c
src/backend/parser/parse_target.c
src/backend/parser/parse_type.c
src/backend/parser/parse_utilcmd.c
src/backend/postmaster/autovacuum.c
src/backend/postmaster/pgstat.c
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
src/backend/replication/logical/launcher.c
src/backend/replication/walsender.c
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteRemove.c
src/backend/rewrite/rewriteSupport.c
src/backend/statistics/extended_stats.c
src/backend/storage/large_object/inv_api.c
src/backend/tcop/pquery.c
src/backend/tsearch/wparser.c
src/backend/utils/adt/acl.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/enum.c
src/backend/utils/adt/expandedrecord.c
src/backend/utils/adt/genfile.c
src/backend/utils/adt/lockfuncs.c
src/backend/utils/adt/misc.c
src/backend/utils/adt/orderedsetaggs.c
src/backend/utils/adt/partitionfuncs.c
src/backend/utils/adt/pgstatfuncs.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/trigfuncs.c
src/backend/utils/adt/tsvector_op.c
src/backend/utils/cache/catcache.c
src/backend/utils/cache/inval.c
src/backend/utils/cache/lsyscache.c
src/backend/utils/cache/plancache.c
src/backend/utils/cache/relcache.c
src/backend/utils/cache/relfilenodemap.c
src/backend/utils/cache/syscache.c
src/backend/utils/cache/typcache.c
src/backend/utils/fmgr/fmgr.c
src/backend/utils/fmgr/funcapi.c
src/backend/utils/init/miscinit.c
src/backend/utils/init/postinit.c
src/backend/utils/misc/guc.c
src/backend/utils/misc/pg_controldata.c
src/backend/utils/misc/postgresql.conf.sample
src/backend/utils/mmgr/portalmem.c
src/bin/initdb/initdb.c
src/bin/pg_dump/pg_backup.h
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/t/001_basic.pl
src/bin/pg_dump/t/002_pg_dump.pl
src/bin/pg_upgrade/check.c
src/bin/pgbench/t/001_pgbench_with_server.pl
src/bin/psql/describe.c
src/bin/psql/tab-complete.c
src/include/access/heapam.h
src/include/access/htup_details.h
src/include/access/reloptions.h
src/include/access/sysattr.h
src/include/access/tupdesc.h
src/include/bootstrap/bootstrap.h
src/include/catalog/catalog.h
src/include/catalog/catversion.h
src/include/catalog/genbki.h
src/include/catalog/heap.h
src/include/catalog/indexing.h
src/include/catalog/objectaddress.h
src/include/catalog/pg_aggregate.h
src/include/catalog/pg_am.h
src/include/catalog/pg_amop.h
src/include/catalog/pg_amproc.h
src/include/catalog/pg_attrdef.h
src/include/catalog/pg_attribute.h
src/include/catalog/pg_auth_members.h
src/include/catalog/pg_authid.h
src/include/catalog/pg_cast.h
src/include/catalog/pg_class.dat
src/include/catalog/pg_class.h
src/include/catalog/pg_collation.h
src/include/catalog/pg_constraint.h
src/include/catalog/pg_conversion.h
src/include/catalog/pg_database.h
src/include/catalog/pg_db_role_setting.h
src/include/catalog/pg_default_acl.h
src/include/catalog/pg_depend.h
src/include/catalog/pg_description.h
src/include/catalog/pg_enum.h
src/include/catalog/pg_event_trigger.h
src/include/catalog/pg_extension.h
src/include/catalog/pg_foreign_data_wrapper.h
src/include/catalog/pg_foreign_server.h
src/include/catalog/pg_foreign_table.h
src/include/catalog/pg_index.h
src/include/catalog/pg_inherits.h
src/include/catalog/pg_init_privs.h
src/include/catalog/pg_language.h
src/include/catalog/pg_largeobject.h
src/include/catalog/pg_largeobject_metadata.h
src/include/catalog/pg_namespace.h
src/include/catalog/pg_opclass.h
src/include/catalog/pg_operator.h
src/include/catalog/pg_opfamily.h
src/include/catalog/pg_partitioned_table.h
src/include/catalog/pg_pltemplate.h
src/include/catalog/pg_policy.h
src/include/catalog/pg_proc.dat
src/include/catalog/pg_proc.h
src/include/catalog/pg_publication.h
src/include/catalog/pg_publication_rel.h
src/include/catalog/pg_range.h
src/include/catalog/pg_replication_origin.h
src/include/catalog/pg_rewrite.h
src/include/catalog/pg_seclabel.h
src/include/catalog/pg_sequence.h
src/include/catalog/pg_shdepend.h
src/include/catalog/pg_shdescription.h
src/include/catalog/pg_shseclabel.h
src/include/catalog/pg_statistic.h
src/include/catalog/pg_statistic_ext.h
src/include/catalog/pg_subscription.h
src/include/catalog/pg_subscription_rel.h
src/include/catalog/pg_tablespace.h
src/include/catalog/pg_transform.h
src/include/catalog/pg_trigger.h
src/include/catalog/pg_ts_config.h
src/include/catalog/pg_ts_config_map.h
src/include/catalog/pg_ts_dict.h
src/include/catalog/pg_ts_parser.h
src/include/catalog/pg_ts_template.h
src/include/catalog/pg_type.h
src/include/catalog/pg_user_mapping.h
src/include/catalog/reformat_dat_file.pl
src/include/commands/copy.h
src/include/commands/event_trigger.h
src/include/executor/executor.h
src/include/executor/spi.h
src/include/executor/spi_priv.h
src/include/nodes/execnodes.h
src/include/nodes/parsenodes.h
src/include/parser/parse_clause.h
src/include/utils/guc.h
src/include/utils/rel.h
src/include/utils/relcache.h
src/include/utils/syscache.h
src/interfaces/ecpg/preproc/ecpg.addons
src/pl/plperl/plperl.c
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/pl_funcs.c
src/pl/plpgsql/src/pl_gram.y
src/pl/plpgsql/src/pl_scanner.c
src/pl/plpgsql/src/plpgsql.h
src/pl/tcl/expected/pltcl_queries.out
src/pl/tcl/expected/pltcl_setup.out
src/pl/tcl/pltcl.c
src/pl/tcl/sql/pltcl_queries.sql
src/pl/tcl/sql/pltcl_setup.sql
src/test/modules/test_ddl_deparse/expected/create_table.out
src/test/modules/test_ddl_deparse/sql/create_table.sql
src/test/modules/test_ddl_deparse/test_ddl_deparse.c
src/test/modules/test_predtest/test_predtest.c
src/test/regress/expected/alter_table.out
src/test/regress/expected/copy2.out
src/test/regress/expected/create_index.out
src/test/regress/expected/create_table.out
src/test/regress/expected/create_table_like.out
src/test/regress/expected/enum.out
src/test/regress/expected/errors.out
src/test/regress/expected/foreign_data.out
src/test/regress/expected/inherit.out
src/test/regress/expected/insert_conflict.out
src/test/regress/expected/misc_sanity.out
src/test/regress/expected/opr_sanity.out
src/test/regress/expected/prepare.out
src/test/regress/expected/privileges.out
src/test/regress/expected/reloptions.out
src/test/regress/expected/replica_identity.out
src/test/regress/expected/roleattributes.out
src/test/regress/expected/rowsecurity.out
src/test/regress/expected/rowtypes.out
src/test/regress/expected/sanity_check.out
src/test/regress/expected/triggers.out
src/test/regress/expected/without_oid.out [deleted file]
src/test/regress/parallel_schedule
src/test/regress/serial_schedule
src/test/regress/sql/alter_table.sql
src/test/regress/sql/copy2.sql
src/test/regress/sql/create_index.sql
src/test/regress/sql/create_table.sql
src/test/regress/sql/create_table_like.sql
src/test/regress/sql/errors.sql
src/test/regress/sql/foreign_data.sql
src/test/regress/sql/inherit.sql
src/test/regress/sql/insert_conflict.sql
src/test/regress/sql/misc_sanity.sql
src/test/regress/sql/prepare.sql
src/test/regress/sql/privileges.sql
src/test/regress/sql/reloptions.sql
src/test/regress/sql/replica_identity.sql
src/test/regress/sql/roleattributes.sql
src/test/regress/sql/rowsecurity.sql
src/test/regress/sql/rowtypes.sql
src/test/regress/sql/sanity_check.sql
src/test/regress/sql/triggers.sql
src/test/regress/sql/without_oid.sql [deleted file]
src/tools/findoidjoins/findoidjoins.c

index 0a27701e9c6f19f0f5aa428d2110da6c618a5b69..ea0ec201f0d72cd545bed19b00bdf41a555b9312 100644 (file)
@@ -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",
index cacbd718541fd98769c5154491dc71f4099ce974..7fbc7355929a1b944ab9738e651b955ee99c29d0 100644 (file)
@@ -1,5 +1,5 @@
 -- 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';
index ffa90c3c3c7f2609e4ecbec931d56025cc6aede4..776bbb10267c4366d3a195a41dd818994a87700e 100644 (file)
@@ -1,64 +1,66 @@
 -- 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)
 
index 0e037984e1b6a90e00822888110cbfb5aed2beb2..4526cc4f0aa63248b852f105eb73139be5cfe696 100644 (file)
@@ -1,6 +1,6 @@
 -- money check
 
-CREATE TABLE moneytmp (a money) WITH OIDS;
+CREATE TABLE moneytmp (a money);
 
 \copy moneytmp from 'data/cash.data'
 
index fd03b82bd440114ebb69f012aca781a454d5c9a9..c9358234ce9f4af65a16a3cf0b8056c61d878819 100644 (file)
@@ -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;
index c6460688486544e006a6f31ebf6352a1274fce56..3b73ff13f19a7b293807fa0f37ac96decb0c42e1 100644 (file)
@@ -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",
index 2cf09aecf6eb76d6b4e499272d863e2909959316..4368d92041303e63d716f589a5bbe00fefebf5a8 100644 (file)
@@ -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);
 
index d96ba1e8b610db687a20f45fcc92db0b7b60fe91..f7986572555ea450a983f6d810fe8d6af97de5a2 100644 (file)
 #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;
            }
index b410aafa5a904ad61eeaf10b3978f3d10a4b0a33..1bd579fcbb0caeb0ddfe4277103da5474adacc5c 100644 (file)
@@ -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",
index 944dea66fc8641bb744fe7d520014116721da2a5..c1aae9d655121a10892c69f29689087173e7bc04 100644 (file)
@@ -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);
index 6001f4d25efdb6fbc56b80c8beb1df723964622f..654323f1554438cf031a002f0034b673fcf631e0 100644 (file)
@@ -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)
    {
        /*
index 21a2ef5ad3a8eb02c34d0e36c9962d0d0f888fce..e653c302becb985519a52ad6b588ce6b5fbeb482 100644 (file)
@@ -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
 -- ===================================================================
index 6f9c6e193fcce9035810b500636e15a59f85d3a9..a5830bb89b3ce109d541da4c91157e23872cbffd 100644 (file)
@@ -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);
    }
index 88c4cb4783f319fd21d91aa44b727f804f85d50b..6aa9a7f4d9bdf2db4679d4365959d65582357dde 100644 (file)
@@ -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
index e1d31e5b2fab47b9f12a57106596f87106614c98..b27274d83ec7312bee0a78dc4c9afd8af2d519fe 100644 (file)
@@ -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
index 1c0409a7a6532568a72d51b87faec439d0452945..9c5c6061390849463e3542446ec52d544521a756 100644 (file)
@@ -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"
index dba0986e02a85b9bae57d70bba65395534967f28..acffc468d284255f190b596ddec0f0a9b9ab766d 100644 (file)
@@ -758,7 +758,7 @@ exec_object_restorecon(struct selabel_handle *sehnd, Oid catalogId)
                                            NULL, NULL, NULL);
 
                object.classId = DatabaseRelationId;
-               object.objectId = HeapTupleGetOid(tuple);
+               object.objectId = datForm->oid;
                object.objectSubId = 0;
                break;
 
@@ -772,7 +772,7 @@ exec_object_restorecon(struct selabel_handle *sehnd, Oid catalogId)
                                            NULL, NULL);
 
                object.classId = NamespaceRelationId;
-               object.objectId = HeapTupleGetOid(tuple);
+               object.objectId = nspForm->oid;
                object.objectSubId = 0;
                break;
 
@@ -797,7 +797,7 @@ exec_object_restorecon(struct selabel_handle *sehnd, Oid catalogId)
                pfree(namespace_name);
 
                object.classId = RelationRelationId;
-               object.objectId = HeapTupleGetOid(tuple);
+               object.objectId = relForm->oid;
                object.objectSubId = 0;
                break;
 
@@ -838,7 +838,7 @@ exec_object_restorecon(struct selabel_handle *sehnd, Oid catalogId)
                pfree(namespace_name);
 
                object.classId = ProcedureRelationId;
-               object.objectId = HeapTupleGetOid(tuple);
+               object.objectId = proForm->oid;
                object.objectSubId = 0;
                break;
 
index 14000eaaeebcfa2a82994c3f4b1d73306906aec1..f1144492329b3fb678092cf52380a27f9aa2e26d 100644 (file)
@@ -134,8 +134,6 @@ 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;
-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
@@ -157,8 +155,6 @@ ALTER TABLE regtest_ptable ALTER p SET STORAGE PLAIN;
 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
index ae431f6cd2aa6c2556b56e9748bea88de1e77d50..3deadb625262900b837cbe446616f259fe3bb6e6 100644 (file)
@@ -30,7 +30,7 @@ CREATE TABLE regtest_table (x serial primary key, y text);
 
 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');
@@ -112,7 +112,6 @@ DROP SEQUENCE regtest_seq;
 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;
 
index 1c439b57b0ea7469a19ed29e4fb168d25709674e..f6e77fbda13828921bf5744ac5438658f25afa09 100644 (file)
@@ -319,13 +319,6 @@ static void
 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++)
index dbf2bb9602f50181cc6b4906356969ef05958c8f..8bce9b35e1da5db9a2639639e2dae111cbd7d44c 100644 (file)
@@ -14,6 +14,7 @@
 #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"
@@ -385,7 +386,7 @@ unaccent_dict(PG_FUNCTION_ARGS)
        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))
index 0fb309a1bd9773471884466827973ed004d23c45..786abb95d4d99e1be0c99bbe4afa72857c6dea21 100644 (file)
@@ -89,7 +89,7 @@
    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>
 
@@ -714,7 +715,6 @@ $ perl  rewrite_dat_with_prokind.pl  pg_proc.dat
      <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>
@@ -766,7 +766,6 @@ $ perl  rewrite_dat_with_prokind.pl  pg_proc.dat
      <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>
@@ -805,7 +804,7 @@ $ perl  rewrite_dat_with_prokind.pl  pg_proc.dat
 
    <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>
@@ -813,11 +812,7 @@ $ perl  rewrite_dat_with_prokind.pl  pg_proc.dat
       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>
@@ -985,16 +980,16 @@ $ perl  rewrite_dat_with_prokind.pl  pg_proc.dat
   <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>
index 8b7f169d50c34d4d56ff69b7e3304dff586ba8b8..c134bca8096db5a8d2a3604bd842f95e136bca8a 100644 (file)
       <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>
@@ -1538,7 +1538,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -1661,7 +1661,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -1853,15 +1853,6 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       </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>
@@ -2055,7 +2046,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -2193,7 +2184,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -2460,7 +2451,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -2560,7 +2551,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -2790,7 +2781,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -3188,7 +3179,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -3351,7 +3342,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -3454,7 +3445,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -3553,7 +3544,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -4106,7 +4097,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -4313,7 +4304,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -4373,7 +4364,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -4448,7 +4439,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -4553,7 +4544,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -4710,7 +4701,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -5120,7 +5111,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -5458,7 +5449,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -5734,7 +5725,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -6616,7 +6607,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -6797,7 +6788,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -6940,7 +6931,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -7149,7 +7140,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -7295,7 +7286,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -7378,7 +7369,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -7475,7 +7466,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -7549,7 +7540,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
@@ -8061,7 +8052,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       <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>
index 5d76862f461981b0e1d85e7d20a6d59bf372b1b5..d1dab3555906cb8e027b371baf9d0d48a0771cc8 100644 (file)
@@ -7942,35 +7942,6 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
       </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>
index 8c38dde8fb8b64e7bbcfd240b4eb8c96720bc428..cae3fa95a890cf019ad6995d4b25108e2d861d4a 100644 (file)
@@ -4497,25 +4497,22 @@ INSERT INTO mytable VALUES(-1);  -- fails
    <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>
index c8268222af7ab3a066076183d3f7cfad001591dc..61c4a25460347b65b583ebec265288f16d7a816c 100644 (file)
@@ -938,24 +938,6 @@ CREATE TABLE circles (
   </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>
@@ -1056,46 +1038,6 @@ CREATE TABLE circles (
    </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
index 955a13ab7d9eb0f128ec6302667b51c245334d9d..19be824b039170648edf54d95f0d0a085e49eab9 100644 (file)
  </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>
index beb7e03bbcfb181f04e5c3287544924b17d01985..60b0c72ff320cf2f64dee4e49e0754fecb73930b 100644 (file)
@@ -1485,14 +1485,6 @@ GET DIAGNOSTICS integer_var = ROW_COUNT;
          <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>
index 4dd6fe434faecc9ca70d241e8c13915b0bbee23b..7ff828de70084f5eebb6895e3a18eac4876bd269 100644 (file)
@@ -470,24 +470,6 @@ $$ LANGUAGE pltcl;
       </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>
index f0b21452084f88a34a8385c10697d6a884b42996..9f7fb0c1d04e41d85c50c22f7c2fa33cf3eb423d 100644 (file)
@@ -3837,10 +3837,11 @@ CommandComplete (B)
         <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>
index f266be0c37b29a8cb43012be96b5301c344cda19..b27eb6f2aae0047e0fcc75b72beaa87e8eef3268 100644 (file)
@@ -50,7 +50,6 @@ ALTER FOREIGN TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceab
     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>
@@ -223,34 +222,13 @@ ALTER FOREIGN TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceab
     </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>
index f13a6cd944df57278fc289fa79425a649675f032..be1647937dc3fb02291d866719368f95a50f69a9 100644 (file)
@@ -72,7 +72,6 @@ ALTER TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceable>
     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 }
@@ -613,32 +612,13 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </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>
@@ -704,17 +684,6 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       <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>
 
index 9f3c85bf7f9f649d98833d0f7ae7a49129adf657..411941ed31f17df504ed7ed59c45d33912fa0b3e 100644 (file)
@@ -33,7 +33,6 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
 <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>'
@@ -203,18 +202,6 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <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>
@@ -549,8 +536,6 @@ COPY <replaceable class="parameter">count</replaceable>
     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>
@@ -824,7 +809,9 @@ only one flag bit is defined, and the rest must be zero:
           <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>
@@ -895,10 +882,9 @@ distribution).
 
     <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 &mdash; 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>
 
@@ -1001,7 +987,6 @@ COPY <replaceable class="parameter">table_name</replaceable> [ ( <replaceable cl
     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 ]
@@ -1013,7 +998,6 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
     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 ]
@@ -1032,12 +1016,12 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
    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>' ]
index eed4273c4b4dd76808bb95caa1818cce891f927b..7f31ab4d26df93d5357f03876cd631d48895f522 100644 (file)
@@ -45,8 +45,7 @@ CREATE MATERIALIZED VIEW [ IF NOT EXISTS ] <replaceable>table_name</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>
 
@@ -95,7 +94,7 @@ CREATE MATERIALIZED VIEW [ IF NOT EXISTS ] <replaceable>table_name</replaceable>
       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>
index 4b9c8a78017135bbbfe4c1fa0262e71eb3e28955..50d55970020f6fd143d642b0444bc055d159e3cd 100644 (file)
@@ -29,7 +29,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
 ] )
 [ 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> ]
 
@@ -40,7 +40,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
     [, ... ]
 ) ]
 [ 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> ]
 
@@ -51,7 +51,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
     [, ... ]
 ) ] { 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> ]
 
@@ -531,17 +531,13 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
 
      <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>
@@ -1145,46 +1141,21 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       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>
@@ -1528,29 +1499,6 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
 
  <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
@@ -2089,7 +2037,7 @@ CREATE TABLE cities_partdef
 
    <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>
 
index 527138e7872339e2d49479a85736e4737ee128f9..679e8f521ed7625c349f57e1777cafadfd8d7ea9 100644 (file)
@@ -23,7 +23,7 @@ PostgreSQL documentation
 <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>
@@ -127,25 +127,22 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
       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>
@@ -245,14 +242,6 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
    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>
@@ -281,12 +270,12 @@ CREATE TABLE films2 AS
   <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 &gt; $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>
@@ -325,7 +314,7 @@ CREATE TEMP TABLE films_recent WITH (OIDS) ON COMMIT DROP AS
     <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>
 
index b5fa4fb85ccc66e358ff882735e105d5d6bc9ce5..2015410a421940cde03315393f381856d5cb705f 100644 (file)
@@ -438,20 +438,6 @@ PostgreSQL documentation
       </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>
index 6c1a25f5ed59818fc859f30bbba424070e823f42..462e37238192b911e680e19ee56e44dc3981a4da 100644 (file)
@@ -104,13 +104,6 @@ SELECT [ ALL | DISTINCT [ ON ( <replaceable class="parameter">expression</replac
    <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>
index e6ce80032fd5c19cea67545bb4168f3080924172..3407d8ad7398a363ff7d2eade9147bda4c81ef42 100644 (file)
@@ -3654,7 +3654,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     <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>
index 3494ddb5cefe0a99109d7d4f6674a87172a53d11..1e5f4e04c331d94686bc6292944355f30afc8564 100644 (file)
@@ -5650,7 +5650,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     <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>
index 0c1498015ba63aecfcd361a5e0dd4b63f6c81782..23868d65d8e0461899f3813ee9f3b8e9838a8581 100644 (file)
@@ -9237,7 +9237,7 @@ Branch: REL9_1_STABLE [dd1a5b09b] 2014-06-24 13:30:41 +0300
     <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>
index 00316b899c883567e5a7d7cf3165f23d34e85367..c82bbbaa7f851f09b99b038b289c8a00d6c670ff 100644 (file)
@@ -62,7 +62,7 @@ brtuple_disk_tupdesc(BrinDesc *brdesc)
        /* 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++)
        {
index ccb69bdd616e9f1b5a064ed41513f00b6b1654c2..06dd628a5bc6a5ae2656bd54c6185fdafe7bbe49 100644 (file)
@@ -384,7 +384,6 @@ heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
    {
        case TableOidAttributeNumber:
        case SelfItemPointerAttributeNumber:
-       case ObjectIdAttributeNumber:
        case MinTransactionIdAttributeNumber:
        case MinCommandIdAttributeNumber:
        case MaxTransactionIdAttributeNumber:
@@ -642,9 +641,6 @@ heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
            /* 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;
@@ -839,9 +835,6 @@ expand_tuple(HeapTuple *targetHeapTuple,
    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.
@@ -1065,9 +1058,6 @@ heap_form_tuple(TupleDesc tupleDescriptor,
    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);
@@ -1099,9 +1089,6 @@ heap_form_tuple(TupleDesc tupleDescriptor,
    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,
@@ -1171,14 +1158,11 @@ heap_modify_tuple(HeapTuple tuple,
    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;
 }
@@ -1237,14 +1221,11 @@ heap_modify_tuple_by_cols(HeapTuple tuple,
    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;
 }
@@ -1412,9 +1393,6 @@ heap_form_minimal_tuple(TupleDesc tupleDescriptor,
    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);
@@ -1433,9 +1411,6 @@ heap_form_minimal_tuple(TupleDesc tupleDescriptor,
    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,
index db84da06789ca8b9f6afdca319d70dd37f8cdd0b..eece89aa21f08778a3b68042fc574fa7122c6f60 100644 (file)
@@ -757,8 +757,8 @@ add_string_reloption(bits32 kinds, const char *name, const char *desc, const cha
  * 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
@@ -771,7 +771,7 @@ add_string_reloption(bits32 kinds, const char *name, const char *desc, const cha
  */
 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;
@@ -882,9 +882,6 @@ transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
                                    def->defnamespace)));
            }
 
-           if (ignoreOids && strcmp(def->defname, "oids") == 0)
-               continue;
-
            /* ignore if not in the same namespace */
            if (namspace == NULL)
            {
@@ -905,6 +902,24 @@ transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
                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);
index 21fe8ae490982189dbc213b5ab30e4ec1bf06067..fc88aa376ac5263b1375eb9d8ac01711253f617c 100644 (file)
@@ -138,13 +138,9 @@ convert_tuples_by_position(TupleDesc indesc,
 
    /*
     * 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++)
        {
@@ -344,13 +340,9 @@ convert_tuples_by_name_map_if_req(TupleDesc indesc,
 
    /*
     * 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++)
index b0434b467208bc19e2a3bd76453a3a1cedc31235..5354a04639b5fd55849333b32ad863a42c68d2f2 100644 (file)
@@ -42,7 +42,7 @@
  * caller can overwrite this if needed.
  */
 TupleDesc
-CreateTemplateTupleDesc(int natts, bool hasoid)
+CreateTemplateTupleDesc(int natts)
 {
    TupleDesc   desc;
 
@@ -73,7 +73,6 @@ CreateTemplateTupleDesc(int natts, bool hasoid)
    desc->constr = NULL;
    desc->tdtypeid = RECORDOID;
    desc->tdtypmod = -1;
-   desc->tdhasoid = hasoid;
    desc->tdrefcount = -1;      /* assume not reference-counted */
 
    return desc;
@@ -88,12 +87,12 @@ CreateTemplateTupleDesc(int natts, bool hasoid)
  * 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);
@@ -114,7 +113,7 @@ CreateTupleDescCopy(TupleDesc tupdesc)
    TupleDesc   desc;
    int         i;
 
-   desc = CreateTemplateTupleDesc(tupdesc->natts, tupdesc->tdhasoid);
+   desc = CreateTemplateTupleDesc(tupdesc->natts);
 
    /* Flat-copy the attribute array */
    memcpy(TupleDescAttr(desc, 0),
@@ -154,7 +153,7 @@ CreateTupleDescCopyConstr(TupleDesc tupdesc)
    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),
@@ -416,8 +415,6 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
        return false;
    if (tupdesc1->tdtypeid != tupdesc2->tdtypeid)
        return false;
-   if (tupdesc1->tdhasoid != tupdesc2->tdhasoid)
-       return false;
 
    for (i = 0; i < tupdesc1->natts; i++)
    {
@@ -574,7 +571,6 @@ hashTupleDesc(TupleDesc desc)
 
    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));
 
@@ -800,7 +796,7 @@ BuildDescForRelation(List *schema)
     * allocate a new tuple descriptor
     */
    natts = list_length(schema);
-   desc = CreateTemplateTupleDesc(natts, false);
+   desc = CreateTemplateTupleDesc(natts);
    has_not_null = false;
 
    attnum = 0;
@@ -900,7 +896,7 @@ BuildDescFromLists(List *names, List *types, List *typmods, List *collations)
    /*
     * allocate a new tuple descriptor
     */
-   desc = CreateTemplateTupleDesc(natts, false);
+   desc = CreateTemplateTupleDesc(natts);
 
    attnum = 0;
 
index 0a32182dd7fbafbedb4548a458f37b7286be9a37..d7696a1ad03cff536d2bc48a5a59d106905d7a7d 100644 (file)
@@ -104,7 +104,7 @@ initGinState(GinState *state, Relation index)
            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);
index 4d97ff1d5d21b41ff103785e2e16494f39a82be1..6b18bd3afb8a8e84cea59df2f71369e010bec5a2 100644 (file)
@@ -167,7 +167,7 @@ gistrescan(IndexScanDesc scan, ScanKey key, int nkeys,
         * 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,
index da2a8f34c20145d49123f5ecff9473a590b11820..9650145642209bfcc8493dbabc385d2545860be5 100644 (file)
@@ -2454,7 +2454,7 @@ ReleaseBulkInsertStatePin(BulkInsertState bistate)
  * 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)
 {
@@ -2628,8 +2628,6 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
        tup->t_self = heaptup->t_self;
        heap_freetuple(heaptup);
    }
-
-   return HeapTupleGetOid(tup);
 }
 
 /*
@@ -2656,30 +2654,6 @@ heap_prepare_insert(Relation relation, HeapTuple tup, TransactionId xid,
                (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;
@@ -2995,10 +2969,10 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
  * 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);
 }
 
 /*
@@ -3656,21 +3630,6 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
    /* 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);
@@ -4437,13 +4396,12 @@ heap_tuple_attr_equals(TupleDesc tupdesc, int attrnum,
 
    /*
     * 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;
    }
 
@@ -8123,16 +8081,7 @@ ExtractReplicaIdentity(Relation relation, HeapTuple tp, bool key_changed, bool *
        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;
    }
 
@@ -8140,14 +8089,6 @@ ExtractReplicaIdentity(Relation relation, HeapTuple tp, bool key_changed, bool *
    *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
index cd42c50b09c8a2ac468118b83be9eb8e0348d352..fdbaf38126d99d0c3ba554fc01063a2f44634277 100644 (file)
@@ -723,8 +723,6 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
    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;
@@ -1013,8 +1011,6 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
        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);
@@ -1036,8 +1032,6 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
        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,
@@ -1124,13 +1118,10 @@ toast_flatten_tuple(HeapTuple tup, TupleDesc 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;
 
@@ -1244,8 +1235,6 @@ toast_flatten_tuple_to_datum(HeapTupleHeader tup,
    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);
@@ -1259,8 +1248,6 @@ toast_flatten_tuple_to_datum(HeapTupleHeader tup,
    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);
@@ -1796,7 +1783,7 @@ toast_delete_datum(Relation rel, Datum value, bool is_speculative)
  *
  * 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
index 599203c96ce8f09598955764a9cfad11a9395504..66b940c66ccba0b76c7a9c50559e163a7f9c70b3 100644 (file)
@@ -434,7 +434,7 @@ pg_last_committed_xact(PG_FUNCTION_ARGS)
     * 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",
index 365daf153abe55f1e4f8d9d1b17869c9cbe2fcae..82346f1000d3f2e3f6a9f5f604ebb4b37e711ad9 100644 (file)
@@ -3368,7 +3368,7 @@ pg_get_multixact_members(PG_FUNCTION_ARGS)
                                                false);
        multi->iter = 0;
 
-       tupdesc = CreateTemplateTupleDesc(2, false);
+       tupdesc = CreateTemplateTupleDesc(2);
        TupleDescInitEntry(tupdesc, (AttrNumber) 1, "xid",
                           XIDOID, -1, 0);
        TupleDescInitEntry(tupdesc, (AttrNumber) 2, "mode",
index 3942734e5ae66659a6c6ef3c831269b1ed9ad76f..e65dccc6a2c54e23919a639d66944860a6fc271c 100644 (file)
@@ -734,7 +734,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS)
 
        /* 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",
index 664735b38146af3887aaa011608444c9b2137d0c..a5eb29e01acaf91e81152db01a7720ffe6ee7571 100644 (file)
@@ -451,8 +451,8 @@ ForceTransactionIdLimitUpdate(void)
  * 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
index a31adcca5ebf0e1a368a86293164c546a1203459..bd18f496af1a72e4b05a209b1c9e320edb312b0a 100644 (file)
@@ -471,7 +471,7 @@ pg_walfile_name_offset(PG_FUNCTION_ARGS)
     * 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",
index 4c72989cc25e74ae563d671b95579bf82455eb19..71c3714c48c9f838af6aa890e271a17fd89c56c6 100644 (file)
@@ -113,8 +113,8 @@ static int num_columns_read = 0;
 %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
@@ -123,7 +123,7 @@ static int num_columns_read = 0;
 /* 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
@@ -170,7 +170,7 @@ Boot_CloseStmt:
        ;
 
 Boot_CreateStmt:
-         XCREATE boot_ident oidspec optbootstrap optsharedrelation optwithoutoids optrowtypeoid LPAREN
+         XCREATE boot_ident oidspec optbootstrap optsharedrelation optrowtypeoid LPAREN
                {
                    do_start();
                    numattr = 0;
@@ -192,7 +192,7 @@ Boot_CreateStmt:
 
                    do_start();
 
-                   tupdesc = CreateTupleDesc(numattr, !($6), attrtypes);
+                   tupdesc = CreateTupleDesc(numattr, attrtypes);
 
                    shared_relation = $5;
 
@@ -236,7 +236,7 @@ Boot_CreateStmt:
                                                      PG_CATALOG_NAMESPACE,
                                                      shared_relation ? GLOBALTABLESPACE_OID : 0,
                                                      $3,
-                                                     $7,
+                                                     $6,
                                                      InvalidOid,
                                                      BOOTSTRAP_SUPERUSERID,
                                                      tupdesc,
@@ -245,8 +245,6 @@ Boot_CreateStmt:
                                                      RELPERSISTENCE_PERMANENT,
                                                      shared_relation,
                                                      mapped_relation,
-                                                     true,
-                                                     0,
                                                      ONCOMMIT_NOOP,
                                                      (Datum) 0,
                                                      false,
@@ -261,13 +259,10 @@ Boot_CreateStmt:
        ;
 
 Boot_InsertStmt:
-         INSERT_TUPLE optoideq
+         INSERT_TUPLE
                {
                    do_start();
-                   if ($2)
-                       elog(DEBUG4, "inserting row with oid %u", $2);
-                   else
-                       elog(DEBUG4, "inserting row");
+      &