drop constraint primary key
drop constraint primary key
От:
"Marie G. Tuite" <marie.tuite@edisonaffiliates.com>
Дата:
project=# select version(); version -------------------------------------------------------------PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96 (1 row) Running above, am trying to drop the primary key, but get the follwing error. project=# alter table class_teacher_rlt drop constraint class_teacher_rlt_pkey restrict; ERROR: ALTER TABLE / DROP CONSTRAINT: class_teacher_rlt_pkey does not exist project=# \d class_teacher_rlt Table "class_teacher_rlt" Column | Type | Modifiers ----------------------+--------------------------+-------------------------- --class_id | integer | not nulluser_id | integer | not nullschool_id | integer | not nullstart_date | timestamp with time zone | not null default now()end_date | timestamp with time zone |class_action_type_id | integer | not null default 1action_detail | character varying(100) |teacher_role_id | integer |ind_prim_teacher | boolean | not null default 'f'::boolind_lead_teacher | boolean | default 'f'status_id | integer | default 1created_date | timestamp with time zone | not null default 'now'last_modified | timestamp with time zone | Primary key: class_teacher_rlt_pkey Any ideas? Thanks. Marie
Re: drop constraint primary key
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Marie G. Tuite" writes: > Running above, am trying to drop the primary key, but get the follwing > error. > project=# alter table class_teacher_rlt drop constraint > class_teacher_rlt_pkey restrict; > ERROR: ALTER TABLE / DROP CONSTRAINT: class_teacher_rlt_pkey does not exist In 7.2 DROP CONSTRAINT only works for CHECK-type constraints; you'll have to drop the underlying index directly to get rid of a primary-key-type constraint. 7.3 does allow DROP CONSTRAINT for this. regards, tom lane