Re: ALTER TABLE can NOT use set (OIDS=true)

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: 自己 <zoulx1982(at)163(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: ALTER TABLE can NOT use set (OIDS=true)
Date: 2016-05-19 13:42:36
Message-ID: CAKFQuwYkS3cr+hB=vPVdYPmLuuTsoNwx3v-C+zvtJ0hsYW-aQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, May 19, 2016 at 2:47 AM, 自己 <zoulx1982(at)163(dot)com> wrote:

> Hi,
> I create a table, and then i want to add oid column, but only can use
> "set with oids", not use "set (oids = true)"
> while create table support both. Is this a problem?
>
> Here is is my testcase, thank you.
> postgres=# create table x(a int) with(oids = false);
> CREATE TABLE
> postgres=# alter table x set(fillfactor = 90);
> ALTER TABLE
> postgres=# alter table x set (oids = true);
> ERROR: unrecognized parameter "oids"
> postgres=#
> postgres=# alter table x set with oids;
> ALTER TABLE
> postgres=#
>

​Not according to the documentation.

http://www.postgresql.org/docs/current/static/sql-altertable.html

The specific difference you are encountering, is that the "SET ( ... )"
syntax is strictly limited to storage parameters. The presence or absence
of OIDs is not considered a storage parameter.

ALTER TABLE:
SET WITH OIDS
SET WITHOUT OIDS
​SET ( storage_parameter = value [, ... ] )

CREATE TABLE:
[ WITH ( storage_parameter [= value] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]

While this may not be an example of consistency it is correctly documented
and fails quickly when done incorrectly. It doesn't seem worth improving
simply for the sake of consistency - and I suspect that we our choice of
syntax is largely or completely guided by the SQL standard.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-05-19 13:43:08 Re: BUG #14149: when use LATERAL functions with IMMUTABLE called multiple times
Previous Message virendra 2016-05-19 12:33:38 BUG #14150: Attempted to delete invisible tuple