Re: Changing the Primary Key Column

From: Brian Kurle <bk(at)travelingbits(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pdxpug(at)postgresql(dot)org
Subject: Re: Changing the Primary Key Column
Date: 2011-02-24 15:56:33
Message-ID: CCB408D1-79DB-47A1-9AA9-8663368BABC9@travelingbits.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

Rich,

As was mentioned by Brent, you may have to look to see what the named constraint is and use it. However, the issue originally was that you weren't using the correct command as you were altering the table, but not altering the column.

Although the PostgreSQL documentation varies between releases, the following appears to be more complete in it's explanations:

http://www.postgresql.org/docs/8.0/static/sql-altertable.html

Brian Kurle
President
Traveling bits, Inc.
Cell: 503 961-2489
Fax: 503 640-3814

On Feb 24, 2011, at 7:51 AM, Rich Shepard wrote:

> On Thu, 24 Feb 2011, Brian Kurle wrote:
>
>> # alter table water_well alter column sequence_no drop not null;
>
> Brian,
>
> nevada=# alter table water_well alter column sequence_no drop not null;
> ERROR: column "sequence_no" is in a primary key
>
>> http://www.java2s.com/Code/PostgreSQL/Constraints/ALTERTABLEemployeeALTERCOLUMNidDROPNOTNULL.htm
>
> The example above does not have the id column as primary key or any other
> constraint.
>
> Rich
>
> --
> Sent via pdxpug mailing list (pdxpug(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pdxpug
>

In response to

Responses

Browse pdxpug by date

  From Date Subject
Next Message Rich Shepard 2011-02-24 15:59:15 Re: Changing the Primary Key Column
Previous Message Rich Shepard 2011-02-24 15:51:50 Re: Changing the Primary Key Column