how can i detach a primary key of table from a sequence with out having to drop the table
1 Answer
With "detach" you mean probably, removing the default for the column to the next value of the sequence. For example, say you have a table definition like this:
Column | Type | Modifiers
------------+---------+----------------------------------------------------------------
yourcolumn | integer | not null default nextval('yourtable_yourcolumn_seq'::regclass)
you want to remove this part: default nextval('yourtable_yourcolumn_seq'::regclass)
If so, you can do it with this statement:
ALTER TABLE yourtable ALTER COLUMN yourcolumn DROP DEFAULT;
1 Comment
mekbib.awoke
Thank you, that was what I was looking for, an ALTER query.