pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ALTER TABLE can NOT use set (OIDS=true)
2+ messages / 2 participants
[nested] [flat]

* ALTER TABLE can NOT use set (OIDS=true)
@ 2016-05-19 06:47 自己 <zoulx1982@163.com>
  2016-05-19 13:42 ` Re: ALTER TABLE can NOT use set (OIDS=true) David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: 自己 @ 2016-05-19 06:47 UTC (permalink / raw)
  To: pgsql-bugs

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=#

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ALTER TABLE can NOT use set (OIDS=true)
  2016-05-19 06:47 ALTER TABLE can NOT use set (OIDS=true) 自己 <zoulx1982@163.com>
@ 2016-05-19 13:42 ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2016-05-19 13:42 UTC (permalink / raw)
  To: 自己 <zoulx1982@163.com>; +Cc: pgsql-bugs

On Thu, May 19, 2016 at 2:47 AM, 自己 <zoulx1982@163.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.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-05-19 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19 06:47 ALTER TABLE can NOT use set (OIDS=true) 自己 <zoulx1982@163.com>
2016-05-19 13:42 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox