Discussion:
constaint addition to existing schema
(too old to reply)
Jodi Kanter
2003-12-22 17:26:18 UTC
Permalink
I missed a constraint the last time that I loaded my database. Can I add
an additional constraint without having to drop and rerun the table?
If not, can I do just that one table without having to do the entire schema?
Jodi
--
/_______________________________
//Jodi L Kanter
BioInformatics Database Administrator
University of Virginia
(434) 924-2846
***@virginia.edu <mailto:***@virginia.edu>/



/ /

/ /
Yuji Shinozaki
2003-12-22 20:17:02 UTC
Permalink
You should probably read about the specifics in the documentation
(see http://www.postgresql.org/docs/)

But you could use something like (e.g.)

ALTER TABLE ONLY question_category
ADD CONSTRAINT question_category_external_id_key UNIQUE (external_id);

which adds a UNIQUE constraint to the column external_id in table
question_category. Other types of constraints have slightly different
syntax.


HTH,
yuji
----
Post by Jodi Kanter
I missed a constraint the last time that I loaded my database. Can I add
an additional constraint without having to drop and rerun the table?
If not, can I do just that one table without having to do the entire schema?
Jodi
--
/_______________________________
//Jodi L Kanter
BioInformatics Database Administrator
University of Virginia
(434) 924-2846
/ /
/ /
Yuji Shinozaki Computer Systems Senior Engineer
***@virginia.edu Advanced Technologies Group
(434)924-7171 Information Technology & Communication
http://www.people.virginia.edu/~ys2n University of Virginia


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
Bruno Wolff III
2003-12-24 04:06:38 UTC
Permalink
On Mon, Dec 22, 2003 at 12:26:18 -0500,
Post by Jodi Kanter
I missed a constraint the last time that I loaded my database. Can I add
an additional constraint without having to drop and rerun the table?
If not, can I do just that one table without having to do the entire schema?
Jodi
ALTER TABLE should allow you to do this.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Loading...