ENABLE RULE <replaceable class="PARAMETER">rewrite_rule_name</replaceable>
ENABLE REPLICA RULE <replaceable class="PARAMETER">rewrite_rule_name</replaceable>
ENABLE ALWAYS RULE <replaceable class="PARAMETER">rewrite_rule_name</replaceable>
- SET WITH OIDS
- SET WITHOUT OIDS
INHERIT <replaceable class="PARAMETER">parent_table</replaceable>
NO INHERIT <replaceable class="PARAMETER">parent_table</replaceable>
OWNER TO <replaceable class="PARAMETER">new_owner</replaceable>
</listitem>
</varlistentry>
- <varlistentry>
- <term><literal>SET WITH OIDS</literal></term>
- <listitem>
- <para>
- This form adds an <literal>oid</literal> system column to the
- table (see <xref linkend="ddl-system-columns">).
- It does nothing if the table already has OIDs.
- </para>
-
- <para>
- Note that this is not equivalent to <literal>ADD COLUMN oid oid</>;
- that would add a normal column that happened to be named
- <literal>oid</>, 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.
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry>
<term><literal>INHERIT <replaceable class="PARAMETER">parent_table</replaceable></literal></term>
<listitem>
There must also be matching child-table constraints for all
<literal>CHECK</literal> constraints of the parent.
</para>
+
+ <para>
+ The parent must not have OIDs because foreign table can't have OIDs.
+ </para>
</listitem>
</varlistentry>
that would add a normal column that happened to be named
<literal>oid</>, not a system column.
</para>
+
+ <para>
+ If the target table has been inherited by any foreign table, you can't
+ add <literal>oid</literal> system column because foreign table can't have
+ <literal>oid</literal>.
+ </para>
</listitem>
</varlistentry>
] )
[ INHERITS ( <replaceable>parent_table</replaceable> [, ... ] ) ]
SERVER <replaceable class="parameter">server_name</replaceable>
-[ WITH OIDS | WITHOUT OIDS ]
[ OPTIONS ( <replaceable class="PARAMETER">option</replaceable> '<replaceable class="PARAMETER">value</replaceable>' [, ... ] ) ]
<phrase>where <replaceable class="PARAMETER">column_constraint</replaceable> is:</phrase>
</para>
<para>
- Column <literal>STORAGE</> settings are also copied from parent tables.
+ The parent must not have OIDs because foreign table can't have OIDs.
</para>
</listitem>
</listitem>
</varlistentry>
- <varlistentry>
- <term><literal>WITH OIDS | WITHOUT OIDS</literal></term>
- <listitem>
- <para>
- This clause specifies whether rows of the foreign table should have
- OIDs (object identifiers) assigned to them, or not.
- If <literal>WITH OIDS</> is not specified, the default setting depends
- upon the <xref linkend="guc-default-with-oids"> configuration parameter.
- (If the new foreign table inherits from any tables that have OIDs, then
- <literal>WITH OIDS</> is forced even if the command says
- <literal>WITHOUT OIDS</>.)
- </para>
-
- <para>
- If <literal>WITH OIDS</literal> is specified or implied, the first
- column of the rows which was retrieved from the foreign table
- must be the oid column.
- </para>
-
- <para>
- To remove OIDs from a foreign table after it has been created, use <xref
- linkend="sql-alterforeigntable">.
- </para>
- </listitem>
- </varlistentry>
-
</variablelist>
</refsect1>
</para>
</refsect2>
- <refsect2>
- <title><literal>WITH</> clause</title>
-
- <para>
- The <literal>WITH</> clause is a <productname>PostgreSQL</productname>
- extension; neither storage parameters nor OIDs are in the standard.
- </para>
- </refsect2>
-
</refsect1>
pass = AT_PASS_MISC;
break;
case AT_AddOids: /* SET WITH OIDS */
- ATSimplePermissions(rel, false, false, true);
+ ATSimplePermissions(rel, false, false, false);
/* Performs own recursion */
if (!rel->rd_rel->relhasoids || recursing)
ATPrepAddOids(wqueue, rel, recurse, cmd, lockmode);
pass = AT_PASS_ADD_COL;
break;
case AT_DropOids: /* SET WITHOUT OIDS */
- ATSimplePermissions(rel, false, false, true);
+ ATSimplePermissions(rel, false, false, false);
/* Performs own recursion */
if (rel->rd_rel->relhasoids)
{
n->subtype = AT_DropOids;
$$ = (Node *)n;
}
-
/* ALTER TABLE <name> CLUSTER ON <indexname> */
| CLUSTER ON name
{
CreateForeignTableStmt:
CREATE FOREIGN TABLE qualified_name
OptForeignTableElementList OptInherit
- SERVER name OptWith create_generic_options
+ SERVER name create_generic_options
{
CreateForeignTableStmt *n = makeNode(CreateForeignTableStmt);
$4->istemp = false;
n->base.relation = $4;
n->base.tableElts = $5;
n->base.inhRelations = $6;
- n->base.options = $9;
/* FDW-specific data */
n->servername = $8;
- n->options = $10;
+ n->options = $9;
$$ = (Node *) n;
}
;
n->missing_ok = FALSE;
$$ = (Node *)n;
}
- /* ALTER FOREIGN TABLE <name> SET WITH OIDS */
- | SET WITH OIDS
- {
- AlterTableCmd *n = makeNode(AlterTableCmd);
- n->subtype = AT_AddOids;
- $$ = (Node *)n;
- }
- /* ALTER FOREIGN TABLE <name> SET WITHOUT OIDS */
- | SET WITHOUT OIDS
- {
- AlterTableCmd *n = makeNode(AlterTableCmd);
- n->subtype = AT_DropOids;
- $$ = (Node *)n;
- }
/* ALTER FOREIGN TABLE <name> ENABLE RULE <rule> */
| ENABLE_P RULE name
{
ArchiveEntry(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId,
tbinfo->dobj.name,
tbinfo->dobj.namespace->dobj.name,
- (tbinfo->relkind == RELKIND_VIEW) ? NULL : tbinfo->reltablespace,
+ (tbinfo->relkind == RELKIND_VIEW) ? NULL : tbinfo->reltablespace,
tbinfo->rolname,
(strcmp(reltypename, "TABLE") == 0) ? tbinfo->hasoids : false,
reltypename, SECTION_PRE_DATA,
CREATE FOREIGN TABLE ft1 (c1 serial) SERVER sc; -- ERROR
NOTICE: CREATE TABLE will create implicit sequence "ft1_c1_seq" for serial column "ft1.c1"
ERROR: referenced relation "ft1" is not a table
+CREATE FOREIGN TABLE ft1 () SERVER sc WITH OIDS; -- ERROR
+ERROR: syntax error at or near "WITH OIDS"
+LINE 1: CREATE FOREIGN TABLE ft1 () SERVER sc WITH OIDS;
+ ^
CREATE FOREIGN TABLE ft1 (
c1 integer OPTIONS (force_not_null 'true') NOT NULL,
c2 text DEFAULT 'foo',
Server: sc
Has OIDs: no
-CREATE FOREIGN TABLE ft2 () INHERITS (t1) SERVER sc WITH OIDS OPTIONS (delimiter ' ', quote '`');
+CREATE FOREIGN TABLE ft2 () INHERITS (t1) SERVER sc OPTIONS (delimiter ' ', quote '`');
\d+ ft2
Foreign table "public.ft2"
Column | Type | Modifiers | Storage | Description | Options
"t1_c3_check" CHECK (c3 > '01-01-2000'::date)
Server: sc
Inherits: t1
-Has OIDs: yes
+Has OIDs: no
\det+
List of foreign tables
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT IF EXISTS no_const;
NOTICE: constraint "no_const" of relation "ft1" does not exist, skipping
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c1_check;
-ALTER FOREIGN TABLE ft1 SET WITH OIDS;
-ALTER FOREIGN TABLE ft1 SET WITHOUT OIDS;
+ALTER FOREIGN TABLE ft1 SET WITH OIDS; -- ERROR
+ERROR: syntax error at or near "WITH OIDS"
+LINE 1: ALTER FOREIGN TABLE ft1 SET WITH OIDS;
+ ^
ALTER FOREIGN TABLE ft1 ENABLE RULE ft1_insert_rule;
ALTER FOREIGN TABLE ft1 ENABLE ALWAYS RULE ft1_insert_rule;
ALTER FOREIGN TABLE ft1 ENABLE REPLICA RULE ft1_insert_rule;
CREATE FOREIGN TABLE ft1 () INHERITS () SERVER sc; -- ERROR
CREATE FOREIGN TABLE ft1 () INHERITS (no_table) SERVER sc; -- ERROR
CREATE FOREIGN TABLE ft1 (c1 serial) SERVER sc; -- ERROR
+CREATE FOREIGN TABLE ft1 () SERVER sc WITH OIDS; -- ERROR
CREATE FOREIGN TABLE ft1 (
c1 integer OPTIONS (force_not_null 'true') NOT NULL,
c2 text DEFAULT 'foo',
CREATE RULE ft1_insert_rule AS ON INSERT TO ft1 DO INSTEAD
INSERT INTO t1 VALUES (new.c1, new.c2, new.c3);
\d+ ft1
-CREATE FOREIGN TABLE ft2 () INHERITS (t1) SERVER sc WITH OIDS OPTIONS (delimiter ' ', quote '`');
+CREATE FOREIGN TABLE ft2 () INHERITS (t1) SERVER sc OPTIONS (delimiter ' ', quote '`');
\d+ ft2
\det+
CREATE INDEX id_ft1_c2 ON ft1 (c2); -- ERROR
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT no_const; -- ERROR
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT IF EXISTS no_const;
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c1_check;
-ALTER FOREIGN TABLE ft1 SET WITH OIDS;
-ALTER FOREIGN TABLE ft1 SET WITHOUT OIDS;
+ALTER FOREIGN TABLE ft1 SET WITH OIDS; -- ERROR
ALTER FOREIGN TABLE ft1 ENABLE RULE ft1_insert_rule;
ALTER FOREIGN TABLE ft1 ENABLE ALWAYS RULE ft1_insert_rule;
ALTER FOREIGN TABLE ft1 ENABLE REPLICA RULE ft1_insert_rule;