On Thu, May 19, 2016 at 2:47 AM, =E8=87=AA=E5=B7=B1 <zoulx1982@163.com> wro=
te:
> Hi,
> I create a table, and then i want to add oid column, but only can use
> "set with oids", not use "set (oids =3D true)"
> while create table support both. Is this a problem?
>
> Here is is my testcase, thank you.
> postgres=3D# create table x(a int) with(oids =3D false);
> CREATE TABLE
> postgres=3D# alter table x set(fillfactor =3D 90);
> ALTER TABLE
> postgres=3D# alter table x set (oids =3D true);
> ERROR: unrecognized parameter "oids"
> postgres=3D#
> postgres=3D# alter table x set with oids;
> ALTER TABLE
> postgres=3D#
>
=E2=80=8BNot 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
=E2=80=8BSET ( storage_parameter =3D value [, ... ] )
CREATE TABLE:
[ WITH ( storage_parameter [=3D value] [, ... ] ) | WITH OIDS | WITHOUT OID=
S ]
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.