From e925426e82b96724d8708c268d764cee0554fce3 Mon Sep 17 00:00:00 2001
From: Junwang Zhao <zhjwpku@gmail.com>
Date: Tue, 15 Jul 2025 22:58:46 +0800
Subject: [PATCH v1] chore: remove WITHOUT OIDS syntax

---
 doc/src/sgml/ref/alter_foreign_table.sgml     | 12 ----------
 doc/src/sgml/ref/alter_table.sgml             | 12 ----------
 doc/src/sgml/ref/create_table.sgml            | 17 +++-----------
 doc/src/sgml/ref/create_table_as.sgml         | 13 +----------
 src/backend/access/common/reloptions.c        | 22 +------------------
 src/backend/access/heap/heapam_handler.c      |  8 ++-----
 src/backend/commands/createas.c               |  2 +-
 src/backend/commands/indexcmds.c              |  4 ++--
 src/backend/commands/tablecmds.c              | 19 ++++------------
 src/backend/commands/tablespace.c             |  4 ++--
 src/backend/parser/gram.y                     | 10 ---------
 src/backend/tcop/utility.c                    |  1 -
 src/include/access/reloptions.h               |  2 +-
 src/include/nodes/parsenodes.h                |  1 -
 .../test_ddl_deparse/test_ddl_deparse.c       |  3 ---
 src/test/regress/expected/alter_table.out     |  5 ++++-
 src/test/regress/expected/create_table.out    | 14 +++++++-----
 src/test/regress/expected/plpgsql.out         |  6 ++---
 src/test/regress/sql/alter_table.sql          |  2 +-
 src/test/regress/sql/create_table.sql         |  6 ++---
 src/test/regress/sql/plpgsql.sql              |  6 ++---
 21 files changed, 40 insertions(+), 129 deletions(-)

diff --git a/doc/src/sgml/ref/alter_foreign_table.sgml b/doc/src/sgml/ref/alter_foreign_table.sgml
index e2da3cc719f..ccfd944282b 100644
--- a/doc/src/sgml/ref/alter_foreign_table.sgml
+++ b/doc/src/sgml/ref/alter_foreign_table.sgml
@@ -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 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> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
@@ -224,17 +223,6 @@ ALTER FOREIGN TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceab
     </listitem>
    </varlistentry>
 
-   <varlistentry>
-    <term><literal>SET WITHOUT OIDS</literal></term>
-    <listitem>
-     <para>
-      Backward compatibility syntax for removing the <literal>oid</literal>
-      system column. As <literal>oid</literal> system columns cannot be added
-      anymore, this never has an effect.
-     </para>
-    </listitem>
-   </varlistentry>
-
    <varlistentry>
     <term><literal>INHERIT <replaceable class="parameter">parent_table</replaceable></literal></term>
     <listitem>
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index 1e4f26c13f6..70cdc3a58f3 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -76,7 +76,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 WITHOUT OIDS
     SET ACCESS METHOD { <replaceable class="parameter">new_access_method</replaceable> | DEFAULT }
     SET TABLESPACE <replaceable class="parameter">new_tablespace</replaceable>
     SET { LOGGED | UNLOGGED }
@@ -746,17 +745,6 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry id="sql-altertable-desc-set-without-oids">
-    <term><literal>SET WITHOUT OIDS</literal></term>
-    <listitem>
-     <para>
-      Backward-compatible syntax for removing the <literal>oid</literal>
-      system column.  As <literal>oid</literal> system columns cannot be
-      added anymore, this never has an effect.
-     </para>
-    </listitem>
-   </varlistentry>
-
    <varlistentry id="sql-altertable-desc-set-access-method">
     <term><literal>SET ACCESS METHOD</literal></term>
     <listitem>
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml
index dc000e913c1..1e1fa9daf3e 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -30,7 +30,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> ] [, ... ] ) ]
 [ USING <replaceable class="parameter">method</replaceable> ]
-[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITHOUT OIDS ]
+[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ]
 [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
 [ TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> ]
 
@@ -42,7 +42,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> ] [, ... ] ) ]
 [ USING <replaceable class="parameter">method</replaceable> ]
-[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITHOUT OIDS ]
+[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ]
 [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
 [ TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> ]
 
@@ -54,7 +54,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> ] [, ... ] ) ]
 [ USING <replaceable class="parameter">method</replaceable> ]
-[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITHOUT OIDS ]
+[ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ]
 [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
 [ TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> ]
 
@@ -1463,17 +1463,6 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry id="sql-createtable-parms-without-oids">
-    <term><literal>WITHOUT OIDS</literal></term>
-    <listitem>
-     <para>
-      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>
-
    <varlistentry id="sql-createtable-parms-on-commit">
     <term><literal>ON COMMIT</literal></term>
     <listitem>
diff --git a/doc/src/sgml/ref/create_table_as.sgml b/doc/src/sgml/ref/create_table_as.sgml
index 8429333e3af..49c81f68dbc 100644
--- a/doc/src/sgml/ref/create_table_as.sgml
+++ b/doc/src/sgml/ref/create_table_as.sgml
@@ -24,7 +24,7 @@ PostgreSQL documentation
 CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] <replaceable>table_name</replaceable>
     [ (<replaceable>column_name</replaceable> [, ...] ) ]
     [ USING <replaceable class="parameter">method</replaceable> ]
-    [ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) | WITHOUT OIDS ]
+    [ WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ]
     [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
     [ TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> ]
     AS <replaceable>query</replaceable>
@@ -154,17 +154,6 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
     </listitem>
    </varlistentry>
 
-   <varlistentry>
-    <term><literal>WITHOUT OIDS</literal></term>
-    <listitem>
-     <para>
-      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>
-
    <varlistentry>
     <term><literal>ON COMMIT</literal></term>
     <listitem>
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 50747c16396..d9940c9bb53 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -1151,9 +1151,6 @@ add_local_string_reloption(local_relopts *relopts, const char *name,
  * reloptions value (possibly NULL), and we replace or remove entries
  * as needed.
  *
- * 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
  * listed in validnsps.  The NULL namespace is always valid and need not be
@@ -1165,7 +1162,7 @@ add_local_string_reloption(local_relopts *relopts, const char *name,
  */
 Datum
 transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
-					const char *const validnsps[], bool acceptOidsOff, bool isReset)
+					const char *const validnsps[], bool isReset)
 {
 	Datum		result;
 	ArrayBuildState *astate;
@@ -1305,23 +1302,6 @@ transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
 						 errmsg("invalid option name \"%s\": must not contain \"=\"",
 								name)));
 
-			/*
-			 * 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(name, "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(name) + 1 + strlen(value);
 			/* +1 leaves room for sprintf's trailing null */
 			t = (text *) palloc(len + 1);
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c
index cb4bc35c93e..583d8c8a507 100644
--- a/src/backend/access/heap/heapam_handler.c
+++ b/src/backend/access/heap/heapam_handler.c
@@ -2364,17 +2364,13 @@ heapam_scan_sample_next_tuple(TableScanDesc scan, SampleScanState *scanstate,
 /*
  * Reconstruct and rewrite the given tuple
  *
- * We cannot simply copy the tuple as-is, for several reasons:
+ * We cannot simply copy the tuple as-is, for one reason:
  *
- * 1. We'd like to squeeze out the values of any dropped columns, both
+ * We'd like to squeeze out the values of any dropped columns, both
  * to save space and to ensure we have no corner-case failures. (It's
  * possible for example that the new table hasn't got a TOAST table
  * and so is unable to store any large values of dropped cols.)
  *
- * 2. The tuple might not even be legal for the new table; this is
- * currently only known to happen as an after-effect of ALTER TABLE
- * SET WITHOUT OIDS.
- *
  * So, we must reconstruct the tuple from component Datums.
  */
 static void
diff --git a/src/backend/commands/createas.c b/src/backend/commands/createas.c
index dfd2ab8e862..6a7f61af969 100644
--- a/src/backend/commands/createas.c
+++ b/src/backend/commands/createas.c
@@ -125,7 +125,7 @@ create_ctas_internal(List *attrList, IntoClause *into)
 										create->options,
 										"toast",
 										validnsps,
-										true, false);
+										false);
 
 	(void) heap_reloptions(RELKIND_TOASTVALUE, toast_options, true);
 
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 6f753ab6d7a..154a7290c11 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -909,7 +909,7 @@ DefineIndex(Oid tableId,
 	 * Parse AM-specific options, convert to text array form, validate.
 	 */
 	reloptions = transformRelOptions((Datum) 0, stmt->options,
-									 NULL, NULL, false, false);
+									 NULL, NULL, false);
 
 	(void) index_reloptions(amoptions, reloptions, true);
 
@@ -2241,7 +2241,7 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
 
 			opclassOptions[attn] =
 				transformRelOptions((Datum) 0, attribute->opclassopts,
-									NULL, NULL, false, false);
+									NULL, NULL, false);
 		}
 		else
 			opclassOptions[attn] = (Datum) 0;
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index cb811520c29..cbb8bdc145c 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -930,7 +930,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
 	 * Parse and validate reloptions, if any.
 	 */
 	reloptions = transformRelOptions((Datum) 0, stmt->options, NULL, validnsps,
-									 true, false);
+									 false);
 
 	switch (relkind)
 	{
@@ -4646,7 +4646,6 @@ AlterTableGetLockLevel(List *cmds)
 				 */
 			case AT_DropColumn: /* change visible to SELECT */
 			case AT_AddColumnToView:	/* CREATE VIEW */
-			case AT_DropOids:	/* used to equiv to DropColumn */
 			case AT_EnableAlwaysRule:	/* may change SELECT rules */
 			case AT_EnableReplicaRule:	/* may change SELECT rules */
 			case AT_EnableRule: /* may change SELECT rules */
@@ -5143,11 +5142,6 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
 			ATPrepChangePersistence(tab, rel, cmd->subtype == AT_SetLogged);
 			pass = AT_PASS_MISC;
 			break;
-		case AT_DropOids:		/* SET WITHOUT OIDS */
-			ATSimplePermissions(cmd->subtype, rel,
-								ATT_TABLE | ATT_PARTITIONED_TABLE | ATT_FOREIGN_TABLE);
-			pass = AT_PASS_DROP;
-			break;
 		case AT_SetAccessMethod:	/* SET ACCESS METHOD */
 			ATSimplePermissions(cmd->subtype, rel,
 								ATT_TABLE | ATT_PARTITIONED_TABLE | ATT_MATVIEW);
@@ -5514,9 +5508,6 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab,
 		case AT_SetLogged:		/* SET LOGGED */
 		case AT_SetUnLogged:	/* SET UNLOGGED */
 			break;
-		case AT_DropOids:		/* SET WITHOUT OIDS */
-			/* nothing to do here, oid columns don't exist anymore */
-			break;
 		case AT_SetAccessMethod:	/* SET ACCESS METHOD */
 
 			/*
@@ -6644,8 +6635,6 @@ alter_table_type_to_string(AlterTableType cmdtype)
 			return "SET LOGGED";
 		case AT_SetUnLogged:
 			return "SET UNLOGGED";
-		case AT_DropOids:
-			return "SET WITHOUT OIDS";
 		case AT_SetTableSpace:
 			return "SET TABLESPACE";
 		case AT_SetRelOptions:
@@ -9051,7 +9040,7 @@ ATExecSetOptions(Relation rel, const char *colName, Node *options,
 							&isnull);
 	newOptions = transformRelOptions(isnull ? (Datum) 0 : datum,
 									 castNode(List, options), NULL, NULL,
-									 false, isReset);
+									 isReset);
 	/* Validate new options */
 	(void) attribute_reloptions(newOptions, true);
 
@@ -16651,7 +16640,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
 	}
 
 	/* Generate new proposed reloptions (text array) */
-	newOptions = transformRelOptions(datum, defList, NULL, validnsps, false,
+	newOptions = transformRelOptions(datum, defList, NULL, validnsps,
 									 operation == AT_ResetRelOptions);
 
 	/* Validate */
@@ -16775,7 +16764,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
 		}
 
 		newOptions = transformRelOptions(datum, defList, "toast", validnsps,
-										 false, operation == AT_ResetRelOptions);
+										 operation == AT_ResetRelOptions);
 
 		(void) heap_reloptions(RELKIND_TOASTVALUE, newOptions, true);
 
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index df31eace47a..61827e9dff4 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -335,7 +335,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
 	/* Generate new proposed spcoptions (text array) */
 	newOptions = transformRelOptions((Datum) 0,
 									 stmt->options,
-									 NULL, NULL, false, false);
+									 NULL, NULL, false);
 	(void) tablespace_reloptions(newOptions, true);
 	if (newOptions != (Datum) 0)
 		values[Anum_pg_tablespace_spcoptions - 1] = newOptions;
@@ -1053,7 +1053,7 @@ AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt)
 	datum = heap_getattr(tup, Anum_pg_tablespace_spcoptions,
 						 RelationGetDescr(rel), &isnull);
 	newOptions = transformRelOptions(isnull ? (Datum) 0 : datum,
-									 stmt->options, NULL, NULL, false,
+									 stmt->options, NULL, NULL,
 									 stmt->isReset);
 	(void) tablespace_reloptions(newOptions, true);
 
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 73345bb3c70..fe5f888d86c 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -2735,14 +2735,6 @@ alter_table_cmd:
 					n->missing_ok = false;
 					$$ = (Node *) n;
 				}
-			/* ALTER TABLE <name> SET WITHOUT OIDS, for backward compat */
-			| SET WITHOUT OIDS
-				{
-					AlterTableCmd *n = makeNode(AlterTableCmd);
-
-					n->subtype = AT_DropOids;
-					$$ = (Node *) n;
-				}
 			/* ALTER TABLE <name> CLUSTER ON <indexname> */
 			| CLUSTER ON name
 				{
@@ -4671,10 +4663,8 @@ table_access_method_clause:
 			| /*EMPTY*/							{ $$ = NULL; }
 		;
 
-/* WITHOUT OIDS is legacy only */
 OptWith:
 			WITH reloptions				{ $$ = $2; }
-			| WITHOUT OIDS				{ $$ = NIL; }
 			| /*EMPTY*/					{ $$ = NIL; }
 		;
 
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 4c1faf5575c..c735d83dd22 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -1176,7 +1176,6 @@ ProcessUtilitySlow(ParseState *pstate,
 																cstmt->options,
 																"toast",
 																validnsps,
-																true,
 																false);
 							(void) heap_reloptions(RELKIND_TOASTVALUE,
 												   toast_options,
diff --git a/src/include/access/reloptions.h b/src/include/access/reloptions.h
index dfbb4c85460..7f1847094db 100644
--- a/src/include/access/reloptions.h
+++ b/src/include/access/reloptions.h
@@ -234,7 +234,7 @@ extern void add_local_string_reloption(local_relopts *relopts, const char *name,
 
 extern Datum transformRelOptions(Datum oldOptions, List *defList,
 								 const char *namspace, const char *const validnsps[],
-								 bool acceptOidsOff, bool isReset);
+								 bool isReset);
 extern List *untransformRelOptions(Datum options);
 extern bytea *extractRelOptions(HeapTuple tuple, TupleDesc tupdesc,
 								amoptions_function amoptions);
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 86a236bd58b..9143af97f47 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2442,7 +2442,6 @@ typedef enum AlterTableType
 	AT_DropCluster,				/* SET WITHOUT CLUSTER */
 	AT_SetLogged,				/* SET LOGGED */
 	AT_SetUnLogged,				/* SET UNLOGGED */
-	AT_DropOids,				/* SET WITHOUT OIDS */
 	AT_SetAccessMethod,			/* SET ACCESS METHOD */
 	AT_SetTableSpace,			/* SET TABLESPACE */
 	AT_SetRelOptions,			/* SET (...) -- AM specific parameters */
diff --git a/src/test/modules/test_ddl_deparse/test_ddl_deparse.c b/src/test/modules/test_ddl_deparse/test_ddl_deparse.c
index 193669f2bc1..f7ff67b5638 100644
--- a/src/test/modules/test_ddl_deparse/test_ddl_deparse.c
+++ b/src/test/modules/test_ddl_deparse/test_ddl_deparse.c
@@ -203,9 +203,6 @@ get_altertable_subcmdinfo(PG_FUNCTION_ARGS)
 			case AT_SetUnLogged:
 				strtype = "SET UNLOGGED";
 				break;
-			case AT_DropOids:
-				strtype = "DROP OIDS";
-				break;
 			case AT_SetAccessMethod:
 				strtype = "SET ACCESS METHOD";
 				break;
diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out
index 08984dd98f1..af851ab2511 100644
--- a/src/test/regress/expected/alter_table.out
+++ b/src/test/regress/expected/alter_table.out
@@ -1499,8 +1499,11 @@ delete from atacc1;
 -- try dropping a non-existent column, should fail
 alter table atacc1 drop bar;
 ERROR:  column "bar" of relation "atacc1" does not exist
--- try removing an oid column, should succeed (as it's nonexistent)
+-- try removing an oid column, should fail (not supported)
 alter table atacc1 SET WITHOUT OIDS;
+ERROR:  syntax error at or near "OIDS"
+LINE 1: alter table atacc1 SET WITHOUT OIDS;
+                                       ^
 -- try adding an oid column, should fail (not supported)
 alter table atacc1 SET WITH OIDS;
 ERROR:  syntax error at or near "WITH"
diff --git a/src/test/regress/expected/create_table.out b/src/test/regress/expected/create_table.out
index 76604705a93..ed8178589cd 100644
--- a/src/test/regress/expected/create_table.out
+++ b/src/test/regress/expected/create_table.out
@@ -96,12 +96,16 @@ ERROR:  syntax error at or near "OIDS"
 LINE 1: CREATE TABLE withoid() WITH OIDS;
                                     ^
 CREATE TABLE withoid() WITH (oids);
-ERROR:  tables declared WITH OIDS are not supported
+ERROR:  unrecognized parameter "oids"
 CREATE TABLE withoid() WITH (oids = true);
-ERROR:  tables declared WITH OIDS are not supported
--- but explicitly not adding oids is still supported
-CREATE TEMP TABLE withoutoid() WITHOUT OIDS; DROP TABLE withoutoid;
-CREATE TEMP TABLE withoutoid() WITH (oids = false); DROP TABLE withoutoid;
+ERROR:  unrecognized parameter "oids"
+-- check that tables without oids cannot be created anymore
+CREATE TEMP TABLE withoutoid() WITHOUT OIDS;
+ERROR:  syntax error at or near "WITHOUT"
+LINE 1: CREATE TEMP TABLE withoutoid() WITHOUT OIDS;
+                                       ^
+CREATE TEMP TABLE withoutoid() WITH (oids = false);
+ERROR:  unrecognized parameter "oids"
 -- check restriction with default expressions
 -- invalid use of column reference in default expressions
 CREATE TABLE default_expr_column (id int DEFAULT (id));
diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out
index d8ce39dba3c..8ca832fcd36 100644
--- a/src/test/regress/expected/plpgsql.out
+++ b/src/test/regress/expected/plpgsql.out
@@ -5564,21 +5564,21 @@ CREATE TABLE transition_table_level1
       level1_no serial NOT NULL ,
       level1_node_name varchar(255),
        PRIMARY KEY (level1_no)
-) WITHOUT OIDS;
+);
 CREATE TABLE transition_table_level2
 (
       level2_no serial NOT NULL ,
       parent_no int NOT NULL,
       level1_node_name varchar(255),
        PRIMARY KEY (level2_no)
-) WITHOUT OIDS;
+);
 CREATE TABLE transition_table_status
 (
       level int NOT NULL,
       node_no int NOT NULL,
       status int,
        PRIMARY KEY (level, node_no)
-) WITHOUT OIDS;
+);
 CREATE FUNCTION transition_table_level1_ri_parent_del_func()
   RETURNS TRIGGER
   LANGUAGE plpgsql
diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql
index fc6e36d0e78..0c788334aa0 100644
--- a/src/test/regress/sql/alter_table.sql
+++ b/src/test/regress/sql/alter_table.sql
@@ -1037,7 +1037,7 @@ delete from atacc1;
 -- try dropping a non-existent column, should fail
 alter table atacc1 drop bar;
 
--- try removing an oid column, should succeed (as it's nonexistent)
+-- try removing an oid column, should fail (not supported)
 alter table atacc1 SET WITHOUT OIDS;
 
 -- try adding an oid column, should fail (not supported)
diff --git a/src/test/regress/sql/create_table.sql b/src/test/regress/sql/create_table.sql
index 37a227148e9..c040e6fb9d6 100644
--- a/src/test/regress/sql/create_table.sql
+++ b/src/test/regress/sql/create_table.sql
@@ -64,9 +64,9 @@ CREATE TABLE withoid() WITH OIDS;
 CREATE TABLE withoid() WITH (oids);
 CREATE TABLE withoid() WITH (oids = true);
 
--- but explicitly not adding oids is still supported
-CREATE TEMP TABLE withoutoid() WITHOUT OIDS; DROP TABLE withoutoid;
-CREATE TEMP TABLE withoutoid() WITH (oids = false); DROP TABLE withoutoid;
+-- check that tables without oids cannot be created anymore
+CREATE TEMP TABLE withoutoid() WITHOUT OIDS;
+CREATE TEMP TABLE withoutoid() WITH (oids = false);
 
 -- check restriction with default expressions
 -- invalid use of column reference in default expressions
diff --git a/src/test/regress/sql/plpgsql.sql b/src/test/regress/sql/plpgsql.sql
index d413d995d17..a07dc1c76b1 100644
--- a/src/test/regress/sql/plpgsql.sql
+++ b/src/test/regress/sql/plpgsql.sql
@@ -4486,7 +4486,7 @@ CREATE TABLE transition_table_level1
       level1_no serial NOT NULL ,
       level1_node_name varchar(255),
        PRIMARY KEY (level1_no)
-) WITHOUT OIDS;
+);
 
 CREATE TABLE transition_table_level2
 (
@@ -4494,7 +4494,7 @@ CREATE TABLE transition_table_level2
       parent_no int NOT NULL,
       level1_node_name varchar(255),
        PRIMARY KEY (level2_no)
-) WITHOUT OIDS;
+);
 
 CREATE TABLE transition_table_status
 (
@@ -4502,7 +4502,7 @@ CREATE TABLE transition_table_status
       node_no int NOT NULL,
       status int,
        PRIMARY KEY (level, node_no)
-) WITHOUT OIDS;
+);
 
 CREATE FUNCTION transition_table_level1_ri_parent_del_func()
   RETURNS TRIGGER
-- 
2.41.0

