Обсуждение: OID
Hi list What is the comment to add OIDs to a already existing table, or i have to recreate the table? Thanks, Clemens
On Friday 09 June 2006 06:34 am, "Bert" <clemens.bertschler@gmail.com> thus
communicated:
--> Hi list
--> What is the comment to add OIDs to a already existing table, or i have
--> to recreate the table?
-->
--> Thanks,
--> Clemens
-->
-->
Well, according on \h ALTER TABLE on version 7.4.6 all you can do is SET
WITHOUT OIDS.
master=# \h alter table
Command: ALTER TABLE
Description: change the definition of a table
Syntax:
ALTER TABLE [ ONLY ] name [ * ]
ADD [ COLUMN ] column type [ column_constraint [ ... ] ]
ALTER TABLE [ ONLY ] name [ * ]
DROP [ COLUMN ] column [ RESTRICT | CASCADE ]
ALTER TABLE [ ONLY ] name [ * ]
ALTER [ COLUMN ] column { SET DEFAULT expression | DROP DEFAULT }
ALTER TABLE [ ONLY ] name [ * ]
ALTER [ COLUMN ] column { SET | DROP } NOT NULL
ALTER TABLE [ ONLY ] name [ * ]
ALTER [ COLUMN ] column SET STATISTICS integer
ALTER TABLE [ ONLY ] name [ * ]
ALTER [ COLUMN ] column SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }
ALTER TABLE [ ONLY ] name [ * ]
SET WITHOUT OIDS
ALTER TABLE [ ONLY ] name [ * ]
RENAME [ COLUMN ] column TO new_column
ALTER TABLE name
RENAME TO new_name
ALTER TABLE [ ONLY ] name [ * ]
ADD table_constraint
ALTER TABLE [ ONLY ] name [ * ]
DROP CONSTRAINT constraint_name [ RESTRICT | CASCADE ]
ALTER TABLE name
OWNER TO new_owner
ALTER TABLE name
CLUSTER ON index_name
Thanks, so it seems that i can delete the OIDs but not insert them okay
so i have to recreate the table.
Terry Lee Tucker schrieb:
> On Friday 09 June 2006 06:34 am, "Bert" <clemens.bertschler@gmail.com> thus
> communicated:
> --> Hi list
> --> What is the comment to add OIDs to a already existing table, or i have
> --> to recreate the table?
> -->
> --> Thanks,
> --> Clemens
> -->
> -->
> Well, according on \h ALTER TABLE on version 7.4.6 all you can do is SET
> WITHOUT OIDS.
>
> master=# \h alter table
> Command: ALTER TABLE
> Description: change the definition of a table
> Syntax:
> ALTER TABLE [ ONLY ] name [ * ]
> ADD [ COLUMN ] column type [ column_constraint [ ... ] ]
> ALTER TABLE [ ONLY ] name [ * ]
> DROP [ COLUMN ] column [ RESTRICT | CASCADE ]
> ALTER TABLE [ ONLY ] name [ * ]
> ALTER [ COLUMN ] column { SET DEFAULT expression | DROP DEFAULT }
> ALTER TABLE [ ONLY ] name [ * ]
> ALTER [ COLUMN ] column { SET | DROP } NOT NULL
> ALTER TABLE [ ONLY ] name [ * ]
> ALTER [ COLUMN ] column SET STATISTICS integer
> ALTER TABLE [ ONLY ] name [ * ]
> ALTER [ COLUMN ] column SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }
> ALTER TABLE [ ONLY ] name [ * ]
> SET WITHOUT OIDS
> ALTER TABLE [ ONLY ] name [ * ]
> RENAME [ COLUMN ] column TO new_column
> ALTER TABLE name
> RENAME TO new_name
> ALTER TABLE [ ONLY ] name [ * ]
> ADD table_constraint
> ALTER TABLE [ ONLY ] name [ * ]
> DROP CONSTRAINT constraint_name [ RESTRICT | CASCADE ]
> ALTER TABLE name
> OWNER TO new_owner
> ALTER TABLE name
> CLUSTER ON index_name
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
On Fri, Jun 09, 2006 at 04:27:41AM -0700, Bert wrote: > Thanks, so it seems that i can delete the OIDs but not insert them okay > so i have to recreate the table. I think a better question would be: why are you using OIDs in the first place? You'll almost certainly be much happier with a serial column instead. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461