ALTER TABLE follow up - Mailing list pgsql-sql

From Tom Haddon
Subject ALTER TABLE follow up
Date
Msg-id NEBBIHDGCLBEJMPFAMLACEMNCHAA.tom@betterhealthfoundation.org
Whole thread Raw
Responses Re: ALTER TABLE follow up  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-sql
Hi Folks,

A follow up to the ALTER TABLE question last week. I had asked why I was
getting an error message using the ALTER TABLE to add a PRIMARY KEY, and was
told that this wasn't supported in 7.1.x. I've upgraded to 7.2.1 and now
when I use the following SQL:

ALTER TABLE "agency_contact_info" ADD CONSTRAINT "agency_contact_info_pkey"
PRIMARY KEY NOT NULL ("id");

I get an error message saying that "Existing attribute "id" cannot be a
PRIMARY KEY because it is not marked NOT NULL"

How do I mark this as a NOT NULL to avoid the error message. The column in
question is an INT4 field that has been "acquired" through a SELECT INTO
statement. Is there some way that I can specify the qualities (NOT NULL,
etc.) of the fields in a SELECT INTO statements?

Thanks, Tom

_______________________________
Tom Haddon
IT Director
The Better Health Foundation
414 Thirteenth Street, Suite 450
Oakland, CA 94612
(510) 444-5096
www.betterhealthfoundation.org
_______________________________



pgsql-sql by date:

Previous
From: Josh Berkus
Date:
Subject: Re: problem fetching currval of sequence
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: ALTER TABLE follow up