SQL, Postgres OIDs, What are they and why are they useful?

后端 未结 5 961
一个人的身影
一个人的身影 2020-12-07 10:28

I am looking at some PostgreSQL table creation and I stumbled upon this:

CREATE TABLE (
...
) WITH ( OIDS = FALSE );

I read the documentati

5条回答
  •  渐次进展
    2020-12-07 10:47

    OIDs being phased out

    The core team responsible for Postgres is gradually phasing out OIDs.

    Postgres 12 removes special behavior of OID columns

    The use of OID as an optional system column on your tables is now removed from Postgres 12. You can no longer use:

    • CREATE TABLE … WITH OIDS command
    • default_with_oids (boolean) compatibility setting

    The data type OID remains in Postgres 12. You can explicitly create a column of the type OID.

    After migrating to Postgres 12, any optionally-defined system column oid will no longer be invisible by default. Performing a SELECT * will now include this column. Note that this extra “surprise” column may break naïvely written SQL code.

提交回复
热议问题