From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Remove WITH OIDS support, change oid catalog column visibility. |
Date: | 2018-11-21 00:07:58 |
Message-ID: | E1gPG3j-0003cy-03@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Remove WITH OIDS support, change oid catalog column visibility.
Previously tables declared WITH OIDS, including a significant fraction
of the catalog tables, stored the oid column not as a normal column,
but as part of the tuple header.
This special column was not shown by default, which was somewhat odd,
as it's often (consider e.g. pg_class.oid) one of the more important
parts of a row. Neither pg_dump nor COPY included the contents of the
oid column by default.
The fact that the oid column was not an ordinary column necessitated a
significant amount of special case code to support oid columns. That
already was painful for the existing, but upcoming work aiming to make
table storage pluggable, would have required expanding and duplicating
that "specialness" significantly.
WITH OIDS has been deprecated since 2005 (commit ff02d0a05280e0).
Remove it.
Removing includes:
- CREATE TABLE and ALTER TABLE syntax for declaring the table to be
WITH OIDS has been removed (WITH (oids[ = true]) will error out)
- pg_dump does not support dumping tables declared WITH OIDS and will
issue a warning when dumping one (and ignore the oid column).
- restoring an pg_dump archive with pg_restore will warn when
restoring a table with oid contents (and ignore the oid column)
- COPY will refuse to load binary dump that includes oids.
- pg_upgrade will error out when encountering tables declared WITH
OIDS, they have to be altered to remove the oid column first.
- Functionality to access the oid of the last inserted row (like
plpgsql's RESULT_OID, spi's SPI_lastoid, ...) has been removed.
The syntax for declaring a table WITHOUT OIDS (or WITH (oids = false)
for CREATE TABLE) is still supported. While that requires a bit of
support code, it seems unnecessary to break applications / dumps that
do not use oids, and are explicit about not using them.
The biggest user of WITH OID columns was postgres' catalog. This
commit changes all 'magic' oid columns to be columns that are normally
declared and stored. To reduce unnecessary query breakage all the
newly added columns are still named 'oid', even if a table's column
naming scheme would indicate 'reloid' or such. This obviously
requires adapting a lot code, mostly replacing oid access via
HeapTupleGetOid() with access to the underlying Form_pg_*->oid column.
The bootstrap process now assigns oids for all oid columns in
genbki.pl that do not have an explicit value (starting at the largest
oid previously used), only oids assigned later by oids will be above
FirstBootstrapObjectId. As the oid column now is a normal column the
special bootstrap syntax for oids has been removed.
Oids are not automatically assigned during insertion anymore, all
backend code explicitly assigns oids with GetNewOidWithIndex(). For
the rare case that insertions into the catalog via SQL are called for
the new pg_nextoid() function can be used (which only works on catalog
tables).
The fact that oid columns on system tables are now normal columns
means that they will be included in the set of columns expanded
by * (i.e. SELECT * FROM pg_class will now include the table's oid,
previously it did not). It'd not technically be hard to hide oid
column by default, but that'd mean confusing behavior would either
have to be carried forward forever, or it'd cause breakage down the
line.
While it's not unlikely that further adjustments are needed, the
scope/invasiveness of the patch makes it worthwhile to get merge this
now. It's painful to maintain externally, too complicated to commit
after the code code freeze, and a dependency of a number of other
patches.
Catversion bump, for obvious reasons.
Author: Andres Freund, with contributions by John Naylor
Discussion: https://postgr.es/m/20180930034810.ywp2c7awz7opzcfr@alap3.anarazel.de
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/578b229718e8f15fa779e20f086c4b6bb3776106
Modified Files
--------------
contrib/adminpack/adminpack.c | 2 +-
contrib/btree_gist/expected/cash.out | 2 +-
contrib/btree_gist/expected/oid.out | 40 +--
contrib/btree_gist/sql/cash.sql | 2 +-
contrib/btree_gist/sql/oid.sql | 25 +-
contrib/dblink/dblink.c | 8 +-
contrib/file_fdw/file_fdw.c | 5 +-
contrib/pageinspect/heapfuncs.c | 17 +-
contrib/pg_buffercache/pg_buffercache_pages.c | 2 +-
contrib/pg_visibility/pg_visibility.c | 4 +-
contrib/postgres_fdw/deparse.c | 35 +--
contrib/postgres_fdw/expected/postgres_fdw.out | 41 +--
contrib/postgres_fdw/postgres_fdw.c | 34 +--
contrib/postgres_fdw/sql/postgres_fdw.sql | 11 -
contrib/sepgsql/expected/alter.out | 18 --
contrib/sepgsql/expected/ddl.out | 6 +-
contrib/sepgsql/label.c | 8 +-
contrib/sepgsql/sql/alter.sql | 4 -
contrib/sepgsql/sql/ddl.sql | 3 +-
contrib/test_decoding/test_decoding.c | 7 -
contrib/unaccent/unaccent.c | 3 +-
doc/src/sgml/bki.sgml | 39 ++-
doc/src/sgml/catalogs.sgml | 75 ++---
doc/src/sgml/config.sgml | 29 --
doc/src/sgml/datatype.sgml | 23 +-
doc/src/sgml/ddl.sgml | 58 ----
doc/src/sgml/file-fdw.sgml | 5 +-
doc/src/sgml/plpgsql.sgml | 8 -
doc/src/sgml/pltcl.sgml | 18 --
doc/src/sgml/protocol.sgml | 9 +-
doc/src/sgml/ref/alter_foreign_table.sgml | 28 +-
doc/src/sgml/ref/alter_table.sgml | 37 +--
doc/src/sgml/ref/copy.sgml | 32 +-
doc/src/sgml/ref/create_materialized_view.sgml | 5 +-
doc/src/sgml/ref/create_table.sgml | 88 ++----
doc/src/sgml/ref/create_table_as.sgml | 35 +--
doc/src/sgml/ref/pg_dump.sgml | 14 -
doc/src/sgml/ref/select_into.sgml | 7 -
doc/src/sgml/release-9.1.sgml | 2 +-
doc/src/sgml/release-9.2.sgml | 2 +-
doc/src/sgml/release-9.3.sgml | 2 +-
src/backend/access/brin/brin_tuple.c | 2 +-
src/backend/access/common/heaptuple.c | 29 +-
src/backend/access/common/reloptions.c | 27 +-
src/backend/access/common/tupconvert.c | 16 +-
src/backend/access/common/tupdesc.c | 18 +-
src/backend/access/gin/ginutil.c | 2 +-
src/backend/access/gist/gistscan.c | 2 +-
src/backend/access/heap/heapam.c | 71 +----
src/backend/access/heap/tuptoaster.c | 21 +-
src/backend/access/transam/commit_ts.c | 2 +-
src/backend/access/transam/multixact.c | 2 +-
src/backend/access/transam/twophase.c | 2 +-
src/backend/access/transam/varsup.c | 4 +-
src/backend/access/transam/xlogfuncs.c | 2 +-
src/backend/bootstrap/bootparse.y | 34 +--
src/backend/bootstrap/bootscanner.l | 1 -
src/backend/bootstrap/bootstrap.c | 14 +-
src/backend/catalog/Catalog.pm | 6 +-
src/backend/catalog/aclchk.c | 60 ++--
src/backend/catalog/catalog.c | 153 ++++++----
src/backend/catalog/genbki.pl | 28 +-
src/backend/catalog/heap.c | 87 ++----
src/backend/catalog/index.c | 38 +--
src/backend/catalog/indexing.c | 15 +-
src/backend/catalog/information_schema.sql | 14 +-
src/backend/catalog/namespace.c | 52 ++--
src/backend/catalog/objectaddress.c | 123 +++++---
src/backend/catalog/pg_aggregate.c | 5 +-
src/backend/catalog/pg_collation.c | 11 +-
src/backend/catalog/pg_constraint.c | 31 +-
src/backend/catalog/pg_conversion.c | 14 +-
src/backend/catalog/pg_enum.c | 12 +-
src/backend/catalog/pg_largeobject.c | 18 +-
src/backend/catalog/pg_namespace.c | 12 +-
src/backend/catalog/pg_operator.c | 36 ++-
src/backend/catalog/pg_proc.c | 22 +-
src/backend/catalog/pg_publication.c | 19 +-
src/backend/catalog/pg_subscription.c | 18 +-
src/backend/catalog/pg_type.c | 55 ++--
src/backend/catalog/toasting.c | 4 +-
src/backend/commands/alter.c | 8 +-
src/backend/commands/amcmds.c | 10 +-
src/backend/commands/cluster.c | 16 +-
src/backend/commands/copy.c | 142 +--------
src/backend/commands/createas.c | 21 +-
src/backend/commands/dbcommands.c | 40 +--
src/backend/commands/event_trigger.c | 28 +-
src/backend/commands/explain.c | 2 +-
src/backend/commands/extension.c | 24 +-
src/backend/commands/foreigncmds.c | 45 ++-
src/backend/commands/functioncmds.c | 26 +-
src/backend/commands/indexcmds.c | 27 +-
src/backend/commands/matview.c | 5 +-
src/backend/commands/opclasscmds.c | 47 ++-
src/backend/commands/policy.c | 18 +-
src/backend/commands/prepare.c | 2 +-
src/backend/commands/proclang.c | 18 +-
src/backend/commands/publicationcmds.c | 39 ++-
src/backend/commands/schemacmds.c | 20 +-
src/backend/commands/sequence.c | 2 +-
src/backend/commands/statscmds.c | 13 +-
src/backend/commands/subscriptioncmds.c | 31 +-
src/backend/commands/tablecmds.c | 319 +++----------------
src/backend/commands/tablespace.c | 23 +-
src/backend/commands/trigger.c | 35 ++-
src/backend/commands/tsearchcmds.c | 68 +++--
src/backend/commands/typecmds.c | 38 +--
src/backend/commands/user.c | 42 ++-
src/backend/commands/vacuum.c | 6 +-
src/backend/commands/vacuumlazy.c | 6 -
src/backend/commands/variable.c | 12 +-
src/backend/commands/view.c | 1 -
src/backend/executor/execExpr.c | 1 -
src/backend/executor/execJunk.c | 7 +-
src/backend/executor/execMain.c | 64 ----
src/backend/executor/execPartition.c | 2 +-
src/backend/executor/execSRF.c | 4 +-
src/backend/executor/execTuples.c | 31 +-
src/backend/executor/execUtils.c | 10 -
src/backend/executor/functions.c | 6 +-
src/backend/executor/nodeAgg.c | 4 +-
src/backend/executor/nodeCustom.c | 2 +-
src/backend/executor/nodeForeignscan.c | 2 +-
src/backend/executor/nodeFunctionscan.c | 4 +-
src/backend/executor/nodeIndexonlyscan.c | 2 +-
src/backend/executor/nodeModifyTable.c | 40 +--
src/backend/executor/nodeSubplan.c | 4 +-
src/backend/executor/spi.c | 24 +-
src/backend/foreign/foreign.c | 9 +-
src/backend/optimizer/util/plancat.c | 3 +-
src/backend/parser/gram.y | 48 +--
src/backend/parser/parse_clause.c | 40 ---
src/backend/parser/parse_oper.c | 2 +-
src/backend/parser/parse_relation.c | 23 +-
src/backend/parser/parse_target.c | 2 +-
src/backend/parser/parse_type.c | 16 +-
src/backend/parser/parse_utilcmd.c | 46 +--
src/backend/postmaster/autovacuum.c | 6 +-
src/backend/postmaster/pgstat.c | 16 +-
.../libpqwalreceiver/libpqwalreceiver.c | 2 +-
src/backend/replication/logical/launcher.c | 2 +-
src/backend/replication/walsender.c | 6 +-
src/backend/rewrite/rewriteDefine.c | 25 +-
src/backend/rewrite/rewriteRemove.c | 2 +-
src/backend/rewrite/rewriteSupport.c | 6 +-
src/backend/statistics/extended_stats.c | 2 +-
src/backend/storage/large_object/inv_api.c | 2 +-
src/backend/tcop/pquery.c | 9 +-
src/backend/tsearch/wparser.c | 4 +-
src/backend/utils/adt/acl.c | 5 +-
src/backend/utils/adt/datetime.c | 4 +-
src/backend/utils/adt/enum.c | 13 +-
src/backend/utils/adt/expandedrecord.c | 8 +-
src/backend/utils/adt/genfile.c | 4 +-
src/backend/utils/adt/lockfuncs.c | 2 +-
src/backend/utils/adt/misc.c | 2 +-
src/backend/utils/adt/orderedsetaggs.c | 4 +-
src/backend/utils/adt/partitionfuncs.c | 2 +-
src/backend/utils/adt/pgstatfuncs.c | 2 +-
src/backend/utils/adt/ruleutils.c | 9 +-
src/backend/utils/adt/selfuncs.c | 1 -
src/backend/utils/adt/trigfuncs.c | 11 -
src/backend/utils/adt/tsvector_op.c | 4 +-
src/backend/utils/cache/catcache.c | 86 +++---
src/backend/utils/cache/inval.c | 4 +-
src/backend/utils/cache/lsyscache.c | 4 +-
src/backend/utils/cache/plancache.c | 4 +-
src/backend/utils/cache/relcache.c | 125 ++------
src/backend/utils/cache/relfilenodemap.c | 22 +-
src/backend/utils/cache/syscache.c | 71 +++--
src/backend/utils/cache/typcache.c | 2 +-
src/backend/utils/fmgr/fmgr.c | 4 +-
src/backend/utils/fmgr/funcapi.c | 4 +-
src/backend/utils/init/miscinit.c | 2 +-
src/backend/utils/init/postinit.c | 8 +-
src/backend/utils/misc/guc.c | 22 +-
src/backend/utils/misc/pg_controldata.c | 8 +-
src/backend/utils/misc/postgresql.conf.sample | 1 -
src/backend/utils/mmgr/portalmem.c | 2 +-
src/bin/initdb/initdb.c | 7 +-
src/bin/pg_dump/pg_backup.h | 1 -
src/bin/pg_dump/pg_backup_archiver.c | 72 +----
src/bin/pg_dump/pg_backup_archiver.h | 5 +-
src/bin/pg_dump/pg_dump.c | 203 ++++++------
src/bin/pg_dump/pg_dump.h | 1 -
src/bin/pg_dump/t/001_basic.pl | 8 +-
src/bin/pg_dump/t/002_pg_dump.pl | 175 +----------
src/bin/pg_upgrade/check.c | 85 ++++++
src/bin/pgbench/t/001_pgbench_with_server.pl | 18 +-
src/bin/psql/describe.c | 19 +-
src/bin/psql/tab-complete.c | 5 +-
src/include/access/heapam.h | 4 +-
src/include/access/htup_details.h | 25 +-
src/include/access/reloptions.h | 2 +-
src/include/access/sysattr.h | 13 +-
src/include/access/tupdesc.h | 8 +-
src/include/bootstrap/bootstrap.h | 2 +-
src/include/catalog/catalog.h | 1 -
src/include/catalog/catversion.h | 2 +-
src/include/catalog/genbki.h | 1 -
src/include/catalog/heap.h | 8 +-
src/include/catalog/indexing.h | 4 +-
src/include/catalog/objectaddress.h | 3 +-
src/include/catalog/pg_aggregate.h | 2 +-
src/include/catalog/pg_am.h | 2 +
src/include/catalog/pg_amop.h | 2 +
src/include/catalog/pg_amproc.h | 2 +
src/include/catalog/pg_attrdef.h | 2 +
src/include/catalog/pg_attribute.h | 2 +-
src/include/catalog/pg_auth_members.h | 2 +-
src/include/catalog/pg_authid.h | 1 +
src/include/catalog/pg_cast.h | 2 +
src/include/catalog/pg_class.dat | 36 +--
src/include/catalog/pg_class.h | 2 +-
src/include/catalog/pg_collation.h | 1 +
src/include/catalog/pg_constraint.h | 2 +
src/include/catalog/pg_conversion.h | 1 +
src/include/catalog/pg_database.h | 1 +
src/include/catalog/pg_db_role_setting.h | 2 +-
src/include/catalog/pg_default_acl.h | 1 +
src/include/catalog/pg_depend.h | 2 +-
src/include/catalog/pg_description.h | 2 +-
src/include/catalog/pg_enum.h | 1 +
src/include/catalog/pg_event_trigger.h | 1 +
src/include/catalog/pg_extension.h | 1 +
src/include/catalog/pg_foreign_data_wrapper.h | 1 +
src/include/catalog/pg_foreign_server.h | 1 +
src/include/catalog/pg_foreign_table.h | 2 +-
src/include/catalog/pg_index.h | 2 +-
src/include/catalog/pg_inherits.h | 2 +-
src/include/catalog/pg_init_privs.h | 2 +-
src/include/catalog/pg_language.h | 2 +
src/include/catalog/pg_largeobject.h | 2 +-
src/include/catalog/pg_largeobject_metadata.h | 2 +
src/include/catalog/pg_namespace.h | 2 +
src/include/catalog/pg_opclass.h | 2 +
src/include/catalog/pg_operator.h | 2 +
src/include/catalog/pg_opfamily.h | 2 +
src/include/catalog/pg_partitioned_table.h | 2 +-
src/include/catalog/pg_pltemplate.h | 2 +-
src/include/catalog/pg_policy.h | 1 +
src/include/catalog/pg_proc.dat | 5 +
src/include/catalog/pg_proc.h | 2 +
src/include/catalog/pg_publication.h | 2 +
src/include/catalog/pg_publication_rel.h | 1 +
src/include/catalog/pg_range.h | 2 +-
src/include/catalog/pg_replication_origin.h | 2 +-
src/include/catalog/pg_rewrite.h | 1 +
src/include/catalog/pg_seclabel.h | 2 +-
src/include/catalog/pg_sequence.h | 2 +-
src/include/catalog/pg_shdepend.h | 2 +-
src/include/catalog/pg_shdescription.h | 2 +-
src/include/catalog/pg_shseclabel.h | 2 +-
src/include/catalog/pg_statistic.h | 2 +-
src/include/catalog/pg_statistic_ext.h | 2 +
src/include/catalog/pg_subscription.h | 2 +
src/include/catalog/pg_subscription_rel.h | 6 +-
src/include/catalog/pg_tablespace.h | 1 +
src/include/catalog/pg_transform.h | 1 +
src/include/catalog/pg_trigger.h | 1 +
src/include/catalog/pg_ts_config.h | 1 +
src/include/catalog/pg_ts_config_map.h | 2 +-
src/include/catalog/pg_ts_dict.h | 1 +
src/include/catalog/pg_ts_parser.h | 2 +
src/include/catalog/pg_ts_template.h | 2 +
src/include/catalog/pg_type.h | 2 +
src/include/catalog/pg_user_mapping.h | 2 +
src/include/catalog/reformat_dat_file.pl | 19 +-
src/include/commands/copy.h | 2 +-
src/include/commands/event_trigger.h | 1 -
src/include/executor/executor.h | 15 +-
src/include/executor/spi.h | 1 -
src/include/executor/spi_priv.h | 2 -
src/include/nodes/execnodes.h | 1 -
src/include/nodes/parsenodes.h | 2 -
src/include/parser/parse_clause.h | 1 -
src/include/utils/guc.h | 1 -
src/include/utils/rel.h | 1 -
src/include/utils/relcache.h | 3 +-
src/include/utils/syscache.h | 18 +-
src/interfaces/ecpg/preproc/ecpg.addons | 2 +-
src/pl/plperl/plperl.c | 2 +-
src/pl/plpgsql/src/pl_comp.c | 4 +-
src/pl/plpgsql/src/pl_exec.c | 10 -
src/pl/plpgsql/src/pl_funcs.c | 2 -
src/pl/plpgsql/src/pl_gram.y | 6 -
src/pl/plpgsql/src/pl_scanner.c | 1 -
src/pl/plpgsql/src/plpgsql.h | 2 -
src/pl/tcl/expected/pltcl_queries.out | 15 -
src/pl/tcl/expected/pltcl_setup.out | 4 -
src/pl/tcl/pltcl.c | 26 --
src/pl/tcl/sql/pltcl_queries.sql | 6 -
src/pl/tcl/sql/pltcl_setup.sql | 5 -
.../test_ddl_deparse/expected/create_table.out | 2 +-
.../modules/test_ddl_deparse/sql/create_table.sql | 2 +-
.../modules/test_ddl_deparse/test_ddl_deparse.c | 6 -
src/test/modules/test_predtest/test_predtest.c | 2 +-
src/test/regress/expected/alter_table.out | 167 +---------
src/test/regress/expected/copy2.out | 16 +-
src/test/regress/expected/create_index.out | 16 +-
src/test/regress/expected/create_table.out | 44 +--
src/test/regress/expected/create_table_like.out | 34 ---
src/test/regress/expected/enum.out | 4 +-
src/test/regress/expected/errors.out | 4 +-
src/test/regress/expected/foreign_data.out | 70 +----
src/test/regress/expected/inherit.out | 49 ---
src/test/regress/expected/insert_conflict.out | 67 +---
src/test/regress/expected/misc_sanity.out | 5 +-
src/test/regress/expected/opr_sanity.out | 24 +-
src/test/regress/expected/prepare.out | 46 +--
src/test/regress/expected/privileges.out | 24 +-
src/test/regress/expected/reloptions.out | 9 -
src/test/regress/expected/replica_identity.out | 9 +-
src/test/regress/expected/roleattributes.out | 64 ++--
src/test/regress/expected/rowsecurity.out | 340 ++++++++++-----------
src/test/regress/expected/rowtypes.out | 10 +-
src/test/regress/expected/sanity_check.out | 12 +-
src/test/regress/expected/triggers.out | 26 +-
src/test/regress/expected/without_oid.out | 103 -------
src/test/regress/parallel_schedule | 2 +-
src/test/regress/serial_schedule | 1 -
src/test/regress/sql/alter_table.sql | 105 +------
src/test/regress/sql/copy2.sql | 23 +-
src/test/regress/sql/create_index.sql | 15 +-
src/test/regress/sql/create_table.sql | 32 +-
src/test/regress/sql/create_table_like.sql | 16 -
src/test/regress/sql/errors.sql | 2 +-
src/test/regress/sql/foreign_data.sql | 11 -
src/test/regress/sql/inherit.sql | 26 --
src/test/regress/sql/insert_conflict.sql | 27 +-
src/test/regress/sql/misc_sanity.sql | 5 +-
src/test/regress/sql/prepare.sql | 10 +-
src/test/regress/sql/privileges.sql | 12 +-
src/test/regress/sql/reloptions.sql | 5 -
src/test/regress/sql/replica_identity.sql | 6 +-
src/test/regress/sql/roleattributes.sql | 65 ++--
src/test/regress/sql/rowsecurity.sql | 24 +-
src/test/regress/sql/rowtypes.sql | 6 +-
src/test/regress/sql/sanity_check.sql | 12 +-
src/test/regress/sql/triggers.sql | 25 +-
src/test/regress/sql/without_oid.sql | 92 ------
src/tools/findoidjoins/findoidjoins.c | 4 +-
343 files changed, 2292 insertions(+), 4291 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2018-11-21 04:06:58 | pgsql: Fix sepgsql compile error caused by oid removal. |
Previous Message | Michael Paquier | 2018-11-20 23:49:28 | pgsql: Improve description of buffer used to store records in WAL reade |
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2018-11-21 00:07:59 | Re: [RFC] Removing "magic" oids |
Previous Message | Michael Paquier | 2018-11-21 00:04:17 | Re: ALTER INDEX ... ALTER COLUMN not present in dump |