default_with_oids

A deprecated configuration parameter determining whether newly-created tables should contain an OID column
This entry relates to a PostgreSQL feature which is deprecated and may be desupported in future releases.

default_with_oids is a deprecated configuration parameter 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 and removed in PostgreSQL 12.

Default value

The default value for default_with_oids is: off.

Change history

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