Skip site navigation (1) Skip section navigation (2)

Alter table x add constraing

From: "Thomas Keller" <kellert(at)ohsu(dot)edu>
To: "Postgresql PDX_Users" <pdxpug(at)postgresql(dot)org>
Subject: Alter table x add constraing
Date: 2008-09-26 22:04:32
Message-ID: F365A756-89A1-4609-8868-6691D096EA07@ohsu.edu (view raw or flat)
Thread:
Lists: pdxpug
Hi,
I have a table that inherits most of it's columns. Is this the best,  
or at least a good, way to add a constraint? Is there a more  
convenient (less typing) way?

--sql snippet------
--
-- Name: pi_contact; Type: TABLE; Schema: admin; Owner: kellert;  
Tablespace: 
--

CREATE TABLE pi_contact (
     department      VARCHAR(64),
     organization     VARCHAR(64),
)
INHERITS (contact);

ALTER TABLE admin.pi_contact ADD PRIMARY KEY  
(admin.pi_contact.contact_id);
--
-- Name: TABLE pi_contact; Type: COMMENT; Schema: admin; Owner: kellert
--

COMMENT ON TABLE pi_contact IS 'contains PI contact info, inherits  
from admin.contact';

-- end ----------------------

thanks,
Tom


Tom Keller, Ph.D.
kellert(at)ohsu(dot)edu
503-494-2442
6339b RJH (BSc)
http://www.ohsu.edu/research/core




Responses

pdxpug by date

Next:From: Webb SpragueDate: 2008-09-26 23:11:12
Subject: Re: Alter table x add constraing
Previous:From: Selena DeckelmannDate: 2008-09-22 16:21:38
Subject: Fwd: [ANNOUNCE] PostgreSQL 8.3.4, 8.2.10, etc. Update Release

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group