pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Daniel Verite <daniel@manitou-mail.org>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Cleanup/remove/update references to OID column
Date: Wed, 10 Apr 2019 11:59:18 -0500
Message-ID: <20190410165917.GD10080@telsasoft.com> (raw)
In-Reply-To: <da5a314d-f92d-47ef-b005-8451f26de0f2@manitou-mail.org>
References: <20190408002847.GA904@telsasoft.com>
	<da5a314d-f92d-47ef-b005-8451f26de0f2@manitou-mail.org>

On Wed, Apr 10, 2019 at 06:32:35PM +0200, Daniel Verite wrote:
> 	Justin Pryzby wrote:
> 
> > Cleanup/remove/update references to OID column...
> 
> Just spotted a couple of other references that need updates:

> #1. In catalogs.sgml:
> #2. In ddl.sgml, when describing ctid:

I found and included fixes for a few more references:

 doc/src/sgml/catalogs.sgml           | 2 +-
 doc/src/sgml/ddl.sgml                | 3 +--
 doc/src/sgml/information_schema.sgml | 4 ++--
 doc/src/sgml/ref/create_trigger.sgml | 2 +-
 doc/src/sgml/spi.sgml                | 2 +-

Justin

Attachments:

v2-0001-Cleanup-remove-update-references-to-OID-column.patch (text/x-diff, 6.7K) download From d77f3d95b8cbb6bbc4addaaf4d9b1bcc11f10f10 Mon Sep 17 00:00:00 2001 From: Justin Pryzby <pryzbyj@telsasoft.com> Date: Tue, 2 Apr 2019 19:13:55 -0500 Subject: [PATCH v2] Cleanup/remove/update references to OID column... ..in wake of 578b229718e8f. See also 93507e67c9ca54026019ebec3026de35d30370f9 1464755fc490a9911214817fe83077a3689250ab Reviewed-by: Daniel Verite <daniel@manitou-mail.org> --- doc/src/sgml/catalogs.sgml | 2 +- doc/src/sgml/ddl.sgml | 12 +++++------- doc/src/sgml/information_schema.sgml | 4 ++-- doc/src/sgml/ref/create_trigger.sgml | 2 +- doc/src/sgml/ref/insert.sgml | 12 +++++------- doc/src/sgml/ref/psql-ref.sgml | 3 +++ doc/src/sgml/spi.sgml | 2 +- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 40ddec4..d544e60 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1047,7 +1047,7 @@ <entry></entry> <entry> The number of the column. Ordinary columns are numbered from 1 - up. System columns, such as <structfield>oid</structfield>, + up. System columns, such as <structfield>ctid</structfield>, have (arbitrary) negative numbers. </entry> </row> diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 9e761db..244d5ce 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -1202,8 +1202,7 @@ CREATE TABLE circles ( <structfield>ctid</structfield> will change if it is updated or moved by <command>VACUUM FULL</command>. Therefore <structfield>ctid</structfield> is useless as a long-term row - identifier. The OID, or even better a user-defined serial - number, should be used to identify logical rows. + identifier. A primary key should be used to identify logical rows. </para> </listitem> </varlistentry> @@ -3672,11 +3671,10 @@ VALUES ('Albany', NULL, NULL, 'NY'); <para> Partitions cannot have columns that are not present in the parent. It is not possible to specify columns when creating partitions with - <command>CREATE TABLE</command>, nor is it possible to add columns to - partitions after-the-fact using <command>ALTER TABLE</command>. Tables may be - added as a partition with <command>ALTER TABLE ... ATTACH PARTITION</command> - only if their columns exactly match the parent, including any - <literal>oid</literal> column. + <command>CREATE TABLE</command>, to add columns to + partitions after-the-fact using <command>ALTER TABLE</command>, nor to + add a partition with <command>ALTER TABLE ... ATTACH PARTITION</command> + if its columns would not exactly match those of the parent. </para> </listitem> diff --git a/doc/src/sgml/information_schema.sgml b/doc/src/sgml/information_schema.sgml index 1321ade..9c618b1 100644 --- a/doc/src/sgml/information_schema.sgml +++ b/doc/src/sgml/information_schema.sgml @@ -1312,8 +1312,8 @@ <para> The view <literal>columns</literal> contains information about all table columns (or view columns) in the database. System columns - (<literal>oid</literal>, etc.) are not included. Only those columns are - shown that the current user has access to (by way of being the + (<literal>ctid</literal>, etc.) are not included. The only columns shown + are those to which the current user has access (by way of being the owner or having some privilege). </para> diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml index 6456105..3339a4b 100644 --- a/doc/src/sgml/ref/create_trigger.sgml +++ b/doc/src/sgml/ref/create_trigger.sgml @@ -465,7 +465,7 @@ UPDATE OF <replaceable>column_name1</replaceable> [, <replaceable>column_name2</ that the <literal>NEW</literal> row seen by the condition is the current value, as possibly modified by earlier triggers. Also, a <literal>BEFORE</literal> trigger's <literal>WHEN</literal> condition is not allowed to examine the - system columns of the <literal>NEW</literal> row (such as <literal>oid</literal>), + system columns of the <literal>NEW</literal> row (such as <literal>ctid</literal>), because those won't have been set yet. </para> diff --git a/doc/src/sgml/ref/insert.sgml b/doc/src/sgml/ref/insert.sgml index 62e142f..3e1be4c 100644 --- a/doc/src/sgml/ref/insert.sgml +++ b/doc/src/sgml/ref/insert.sgml @@ -552,13 +552,11 @@ INSERT INTO <replaceable class="parameter">table_name</replaceable> [ AS <replac INSERT <replaceable>oid</replaceable> <replaceable class="parameter">count</replaceable> </screen> The <replaceable class="parameter">count</replaceable> is the - number of rows inserted or updated. If <replaceable - class="parameter">count</replaceable> is exactly one, and the - target table has OIDs, then <replaceable - class="parameter">oid</replaceable> is the <acronym>OID</acronym> - assigned to the inserted row. The single row must have been - inserted rather than updated. Otherwise <replaceable - class="parameter">oid</replaceable> is zero. + number of rows inserted or updated. + <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> diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 08f4bab..0e6e792 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -3794,6 +3794,9 @@ bar command. This variable is only guaranteed to be valid until after the result of the next <acronym>SQL</acronym> command has been displayed. + <productname>PostgreSQL</productname> servers since version 12 do not + support OID system columns in user tables, and LASTOID will always be 0 + following <command>INSERT</command>. </para> </listitem> </varlistentry> diff --git a/doc/src/sgml/spi.sgml b/doc/src/sgml/spi.sgml index 9b2f516..66eced6 100644 --- a/doc/src/sgml/spi.sgml +++ b/doc/src/sgml/spi.sgml @@ -3105,7 +3105,7 @@ int SPI_fnumber(TupleDesc <parameter>rowdesc</parameter>, const char * <paramete <para> If <parameter>colname</parameter> refers to a system column (e.g., - <literal>oid</literal>) then the appropriate negative column number will + <literal>ctid</literal>) then the appropriate negative column number will be returned. The caller should be careful to test the return value for exact equality to <symbol>SPI_ERROR_NOATTRIBUTE</symbol> to detect an error; testing the result for less than or equal to 0 is -- 2.1.4

view thread (19+ messages)  latest in thread

Message-ID: <20190410165917.GD10080@telsasoft.com>
Permalink:  ../20190410165917.GD10080@telsasoft.com/
Also on:    postgresql.org/message-id/20190410165917.GD10080@telsasoft.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, daniel@manitou-mail.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: Cleanup/remove/update references to OID column
  In-Reply-To: <20190410165917.GD10080@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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