default_with_oids

A deprecated GUC determining whether newly-created tables should contain an OID column

default_with_oids is a deprecated GUC determining whether newly-created tables should contain an OID column, if this was not explicitly specified with either WITH OIDS or WITHOUT OIDS when executing CREATE TABLE or CREATE TABLE AS. It also determines whether an OID column is automatically created when executing SELECT INTO.

default_with_oids was added in PostgreSQL 8.1 (commit 7ce9b7c0) and removed in PostgreSQL 12 (commit 578b2297).

Default

Default is off.

Examples

PostgreSQL 11 and earlier only:

postgres=# SET default_with_oids TO on;
SET

postgres=# CREATE TABLE table_with_oids (id int, val text);
CREATE TABLE

postgres=# INSERT INTO table_with_oids VALUES (1, 'foo');
INSERT 16461 1

postgres=# SELECT oid, id, val FROM table_with_oids ;
  oid  | id | val 
-------+----+-----
 16461 |  1 | foo
(1 row)

postgres=# SET default_with_oids TO off;
SET

postgres=# CREATE TABLE table_without_oids (id int, val text);
CREATE TABLE

postgres=# INSERT INTO table_without_oids VALUES (1, 'foo');
INSERT 0 1

postgres=# SELECT oid, id, val FROM table_without_oids ;
ERROR:  column "oid" does not exist
LINE 1: SELECT oid, id, val FROM table_without_oids ;
               ^

Categories

Deprecated, GUC configuration item

See also

OID