pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Remove WITH OIDS support, change oid catalog column visibility.
11+ messages / 6 participants
[nested] [flat]

Commits from this thread:
  2019-02-18 22bc403029  Remove line duplicated during conflict resolution.
  2019-01-14 de66987adb  Re-add default_with_oids GUC to avoid breaking old dump files.
* pgsql: Remove WITH OIDS support, change oid catalog column visibility.
@ 2018-11-21 00:07 Andres Freund <andres@anarazel.de>
  2018-11-21 08:20 ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Christoph Berg <myon@debian.org>
  2019-02-16 10:14 ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 2 replies; 11+ messages in thread

From: Andres Freund @ 2018-11-21 00:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility.
  2018-11-21 00:07 pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
@ 2018-11-21 08:20 ` Christoph Berg <myon@debian.org>
  2018-11-21 08:25   ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Gavin Flower <GavinFlower@archidevsys.co.nz>
  2018-11-21 09:54   ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  1 sibling, 2 replies; 11+ messages in thread

From: Christoph Berg @ 2018-11-21 08:20 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>

Re: Andres Freund 2018-11-21 <E1gPG3j-0003cy-03@gemulon.postgresql.org>
> 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.

postgres=# \d+ pg_class
[...]
Indexe:
    "pg_class_oid_index" UNIQUE, btree (oid)

Now that oid is a proper column, shouldn't that be a PRIMARY KEY?
(Just for the looks.)

Christoph




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility.
  2018-11-21 00:07 pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  2018-11-21 08:20 ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Christoph Berg <myon@debian.org>
@ 2018-11-21 08:25   ` Gavin Flower <GavinFlower@archidevsys.co.nz>
  2018-11-21 08:27     ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Christoph Berg <myon@debian.org>
  1 sibling, 1 reply; 11+ messages in thread

From: Gavin Flower @ 2018-11-21 08:25 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; Andres Freund <andres@anarazel.de>; PostgreSQL Hackers <pgsql-hackers@postgresql.org>

On 21/11/2018 21:20, Christoph Berg wrote:
> Re: Andres Freund 2018-11-21 <E1gPG3j-0003cy-03@gemulon.postgresql.org>
>> 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.
> postgres=# \d+ pg_class
> [...]
> Indexe:
>      "pg_class_oid_index" UNIQUE, btree (oid)
>
> Now that oid is a proper column, shouldn't that be a PRIMARY KEY?
> (Just for the looks.)
>
> Christoph
>
Curious, is there a reason 'Index' is spelt with a trailing 'e'?


Cheers,
Gavin





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility.
  2018-11-21 00:07 pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  2018-11-21 08:20 ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Christoph Berg <myon@debian.org>
  2018-11-21 08:25   ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Gavin Flower <GavinFlower@archidevsys.co.nz>
@ 2018-11-21 08:27     ` Christoph Berg <myon@debian.org>
  0 siblings, 0 replies; 11+ messages in thread

From: Christoph Berg @ 2018-11-21 08:27 UTC (permalink / raw)
  To: Gavin Flower <GavinFlower@archidevsys.co.nz>; +Cc: Andres Freund <andres@anarazel.de>; PostgreSQL Hackers <pgsql-hackers@postgresql.org>

Re: Gavin Flower 2018-11-21 <f6f8ce89-e152-0c80-85a5-41aeee08603e@archidevsys.co.nz>
> Curious, is there a reason 'Index' is spelt with a trailing 'e'?

LANG=de_DE.UTF-8

Christoph




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility.
  2018-11-21 00:07 pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  2018-11-21 08:20 ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Christoph Berg <myon@debian.org>
@ 2018-11-21 09:54   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2019-01-03 18:40     ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 11+ messages in thread

From: Peter Eisentraut @ 2018-11-21 09:54 UTC (permalink / raw)
  To: Christoph Berg <myon@debian.org>; Andres Freund <andres@anarazel.de>; PostgreSQL Hackers <pgsql-hackers@postgresql.org>

On 21/11/2018 09:20, Christoph Berg wrote:
> Re: Andres Freund 2018-11-21 <E1gPG3j-0003cy-03@gemulon.postgresql.org>
>> 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.
> 
> postgres=# \d+ pg_class
> [...]
> Indexe:
>     "pg_class_oid_index" UNIQUE, btree (oid)
> 
> Now that oid is a proper column, shouldn't that be a PRIMARY KEY?
> (Just for the looks.)

This is an independent consideration.  There was nothing before that
prevented an index on an oid column from being a primary key that isn't
still there.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility.
  2018-11-21 00:07 pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  2018-11-21 08:20 ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Christoph Berg <myon@debian.org>
  2018-11-21 09:54   ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
@ 2019-01-03 18:40     ` Tom Lane <tgl@sss.pgh.pa.us>
  2019-01-04 20:39       ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 11+ messages in thread

From: Tom Lane @ 2019-01-03 18:40 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>

I noticed that this patch has broken restores of existing dump files:

psql:testbed.public.backup:82: ERROR:  unrecognized configuration parameter "default_with_oids"

Quite aside from the fact that this won't work if the user tries to
restore in single-transaction or no-error mode, this is really really
unhelpful because it's impossible to tell whether the error is
ignorable or not, except by digging through the dump file.

What you should do is restore that GUC, but add a check-hook that throws
an error for an attempt to set it to "true".

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility.
  2018-11-21 00:07 pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  2018-11-21 08:20 ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Christoph Berg <myon@debian.org>
  2018-11-21 09:54   ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2019-01-03 18:40     ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Tom Lane <tgl@sss.pgh.pa.us>
@ 2019-01-04 20:39       ` Andres Freund <andres@anarazel.de>
  2019-01-07 11:33         ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Amit Khandekar <amitdkhan.pg@gmail.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Andres Freund @ 2019-01-04 20:39 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>

Hi,

On 2019-01-03 13:40:42 -0500, Tom Lane wrote:
> I noticed that this patch has broken restores of existing dump files:
> 
> psql:testbed.public.backup:82: ERROR:  unrecognized configuration parameter "default_with_oids"
> 
> Quite aside from the fact that this won't work if the user tries to
> restore in single-transaction or no-error mode, this is really really
> unhelpful because it's impossible to tell whether the error is
> ignorable or not, except by digging through the dump file.
> 
> What you should do is restore that GUC, but add a check-hook that throws
> an error for an attempt to set it to "true".

Makes sense, I (or a colleague) will look into that next week. Wanna get my
head out of pluggable storage first...

Greetings,

Andres Freund




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility.
  2018-11-21 00:07 pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  2018-11-21 08:20 ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Christoph Berg <myon@debian.org>
  2018-11-21 09:54   ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2019-01-03 18:40     ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Tom Lane <tgl@sss.pgh.pa.us>
  2019-01-04 20:39       ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
@ 2019-01-07 11:33         ` Amit Khandekar <amitdkhan.pg@gmail.com>
  2019-01-14 23:37           ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 11+ messages in thread

From: Amit Khandekar @ 2019-01-07 11:33 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; PostgreSQL Hackers <pgsql-hackers@postgresql.org>

On Sat, 5 Jan 2019 at 02:09, Andres Freund <andres@anarazel.de> wrote:
>
> Hi,
>
> On 2019-01-03 13:40:42 -0500, Tom Lane wrote:
> > I noticed that this patch has broken restores of existing dump files:
> >
> > psql:testbed.public.backup:82: ERROR:  unrecognized configuration parameter "default_with_oids"
> >
> > Quite aside from the fact that this won't work if the user tries to
> > restore in single-transaction or no-error mode, this is really really
> > unhelpful because it's impossible to tell whether the error is
> > ignorable or not, except by digging through the dump file.
> >
> > What you should do is restore that GUC, but add a check-hook that throws
> > an error for an attempt to set it to "true".

Attached is a patch that does this.

>
> Makes sense, I (or a colleague) will look into that next week. Wanna get my
> head out of pluggable storage first...
>
> Greetings,
>
> Andres Freund
>


-- 
Thanks,
-Amit Khandekar
EnterpriseDB Corporation
The Postgres Database Company

Attachments:

errmsg_default_with_oids.patch (application/octet-stream, 3.1K) download diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 6fe1939..78c18f3 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -209,6 +209,7 @@ static void assign_recovery_target_name(const char *newval, void *extra); static bool check_recovery_target_lsn(char **newval, void **extra, GucSource source); static void assign_recovery_target_lsn(const char *newval, void *extra); static bool check_primary_slot_name(char **newval, void **extra, GucSource source); +static bool check_default_with_oids(bool *newval, void **extra, GucSource source); /* Private functions in guc-file.l that need to be called from guc.c */ static ConfigVariable *ProcessConfigFileInternal(GucContext context, @@ -479,6 +480,7 @@ char *event_source; bool row_security; bool check_function_bodies = true; +bool default_with_oids = false; bool session_auth_is_superuser; int log_min_error_statement = ERROR; @@ -1539,6 +1541,18 @@ static struct config_bool ConfigureNamesBool[] = NULL, NULL, NULL }, { + {"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, + gettext_noop("Create new tables with OIDs by default (deprecated)."), + gettext_noop("This parameter cannot be turned on since OIDS cannot" + " be added to user tables; it is retained only to emit" + " a user-friendly error message while restoring from" + " old dump files."), + }, + &default_with_oids, + false, + check_default_with_oids, NULL, NULL + }, + { {"logging_collector", PGC_POSTMASTER, LOGGING_WHERE, gettext_noop("Start a subprocess to capture stderr output and/or csvlogs into log files."), NULL @@ -11310,4 +11324,20 @@ check_primary_slot_name(char **newval, void **extra, GucSource source) return true; } +static bool +check_default_with_oids(bool *newval, void **extra, GucSource source) +{ + if (*newval) + { + /* For the reason for this error message, see the guc definition */ + GUC_check_errcode(ERRCODE_FEATURE_NOT_SUPPORTED); + GUC_check_errmsg("cannot set this parameter to true"); + GUC_check_errhint("OIDs cannot be added to user tables."); + + return false; + } + + return true; +} + #include "guc-file.c" diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out index 43ac5f5..fec84dc 100644 --- a/src/test/regress/expected/guc.out +++ b/src/test/regress/expected/guc.out @@ -767,3 +767,8 @@ NOTICE: text search configuration "no_such_config" does not exist select func_with_bad_set(); ERROR: invalid value for parameter "default_text_search_config": "no_such_config" reset check_function_bodies; +set default_with_oids to f; +-- Should not allow to set it to true. +set default_with_oids to t; +ERROR: cannot set this parameter to true +HINT: OIDs cannot be added to user tables. diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql index 23e5029..3b854ac 100644 --- a/src/test/regress/sql/guc.sql +++ b/src/test/regress/sql/guc.sql @@ -288,3 +288,7 @@ set default_text_search_config = no_such_config; select func_with_bad_set(); reset check_function_bodies; + +set default_with_oids to f; +-- Should not allow to set it to true. +set default_with_oids to t;
^ permalink raw reply [nested|flat] 11+ messages in thread

* Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility.
  2018-11-21 00:07 pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  2018-11-21 08:20 ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Christoph Berg <myon@debian.org>
  2018-11-21 09:54   ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2019-01-03 18:40     ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Tom Lane <tgl@sss.pgh.pa.us>
  2019-01-04 20:39       ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  2019-01-07 11:33         ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Amit Khandekar <amitdkhan.pg@gmail.com>
@ 2019-01-14 23:37           ` Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 11+ messages in thread

From: Andres Freund @ 2019-01-14 23:37 UTC (permalink / raw)
  To: Amit Khandekar <amitdkhan.pg@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; PostgreSQL Hackers <pgsql-hackers@postgresql.org>

Hi,

On 2019-01-07 17:03:20 +0530, Amit Khandekar wrote:
> On Sat, 5 Jan 2019 at 02:09, Andres Freund <andres@anarazel.de> wrote:
> > On 2019-01-03 13:40:42 -0500, Tom Lane wrote:
> > > I noticed that this patch has broken restores of existing dump files:
> > >
> > > psql:testbed.public.backup:82: ERROR:  unrecognized configuration parameter "default_with_oids"
> > >
> > > Quite aside from the fact that this won't work if the user tries to
> > > restore in single-transaction or no-error mode, this is really really
> > > unhelpful because it's impossible to tell whether the error is
> > > ignorable or not, except by digging through the dump file.
> > >
> > > What you should do is restore that GUC, but add a check-hook that throws
> > > an error for an attempt to set it to "true".
> 
> Attached is a patch that does this.

Thanks!  I've pushed this, after some minor editorialization (hiding the
GUC, shortened description, shortened error message).

Regards,

Andres




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility.
  2018-11-21 00:07 pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
@ 2019-02-16 10:14 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2019-02-18 19:12   ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  1 sibling, 1 reply; 11+ messages in thread

From: Peter Eisentraut @ 2019-02-16 10:14 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; pgsql-committers@lists.postgresql.org

On 2018-11-21 01:07, Andres Freund wrote:
> Remove WITH OIDS support, change oid catalog column visibility.

I think you may have accidentally duplicated a line in this patch:

@@ -1602,20 +1602,9 @@ ExecFetchSlotHeapTupleDatum(TupleTableSlot *slot)
 void
 ExecInitResultTypeTL(PlanState *planstate)
 {
-   bool        hasoid;
-   TupleDesc   tupDesc;
-
-   if (ExecContextForcesOids(planstate, &hasoid))
-   {
-       /* context forces OID choice; hasoid is now set correctly */
-   }
-   else
-   {
-       /* given free choice, don't leave space for OIDs in result tuples */
-       hasoid = false;
-   }
+   TupleDesc   tupDesc = ExecTypeFromTL(planstate->plan->targetlist);

-   tupDesc = ExecTypeFromTL(planstate->plan->targetlist, hasoid);
+   tupDesc = ExecTypeFromTL(planstate->plan->targetlist);
    planstate->ps_ResultTupleDesc = tupDesc;
 }

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility.
  2018-11-21 00:07 pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
  2019-02-16 10:14 ` Re: pgsql: Remove WITH OIDS support, change oid catalog column visibility. Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
@ 2019-02-18 19:12   ` Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 11+ messages in thread

From: Andres Freund @ 2019-02-18 19:12 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-committers@lists.postgresql.org

On 2019-02-16 11:14:21 +0100, Peter Eisentraut wrote:
> On 2018-11-21 01:07, Andres Freund wrote:
> > Remove WITH OIDS support, change oid catalog column visibility.
> 
> I think you may have accidentally duplicated a line in this patch:
> 
> @@ -1602,20 +1602,9 @@ ExecFetchSlotHeapTupleDatum(TupleTableSlot *slot)
>  void
>  ExecInitResultTypeTL(PlanState *planstate)
>  {
> -   bool        hasoid;
> -   TupleDesc   tupDesc;
> -
> -   if (ExecContextForcesOids(planstate, &hasoid))
> -   {
> -       /* context forces OID choice; hasoid is now set correctly */
> -   }
> -   else
> -   {
> -       /* given free choice, don't leave space for OIDs in result tuples */
> -       hasoid = false;
> -   }
> +   TupleDesc   tupDesc = ExecTypeFromTL(planstate->plan->targetlist);
> 
> -   tupDesc = ExecTypeFromTL(planstate->plan->targetlist, hasoid);
> +   tupDesc = ExecTypeFromTL(planstate->plan->targetlist);
>     planstate->ps_ResultTupleDesc = tupDesc;
>  }

Indeed! Thanks for noticing. Fixed.




^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2019-02-18 19:12 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 00:07 pgsql: Remove WITH OIDS support, change oid catalog column visibility. Andres Freund <andres@anarazel.de>
2018-11-21 08:20 ` Christoph Berg <myon@debian.org>
2018-11-21 08:25   ` Gavin Flower <GavinFlower@archidevsys.co.nz>
2018-11-21 08:27     ` Christoph Berg <myon@debian.org>
2018-11-21 09:54   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-01-03 18:40     ` Tom Lane <tgl@sss.pgh.pa.us>
2019-01-04 20:39       ` Andres Freund <andres@anarazel.de>
2019-01-07 11:33         ` Amit Khandekar <amitdkhan.pg@gmail.com>
2019-01-14 23:37           ` Andres Freund <andres@anarazel.de>
2019-02-16 10:14 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-02-18 19:12   ` Andres Freund <andres@anarazel.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox