Re: Changing the Primary Key Column

From: Jeff Davis <pgsql(at)j-davis(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 17:55:57
Message-ID: 1298570157.27157.759.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

On Thu, 2011-02-24 at 06:20 -0800, Rich Shepard wrote:
> On Wed, 23 Feb 2011, Joshua D. Drake wrote:
>
> >>> alter table drop constraint
> >>> alter table drop column
> >>> alter table add primary key
>
> > That doesn't make sense. Paste your output please.
>
> nevada-# alter table water_well drop constraint 'not null'
> nevada-# alter table water_well drop column 'sequence_no'
> nevada-# alter table water_well add primary key 'well_log'
> nevada-# commit;
> ERROR: syntax error at or near "alter"
> LINE 2: alter table water_well drop constraint 'not null'
> ^

You forgot the semicolon. You can notice that from the prompt (which is
"-#" rather than "=#".

I think that is causing some of this confusion, although the syntax is
wrong as well -- don't use single-quotes for column/constraint names.

Regards,
Jeff Davis

In response to

Browse pdxpug by date

  From Date Subject
Next Message Rich Shepard 2011-02-24 18:00:56 Re: Changing the Primary Key Column
Previous Message Michael Ewan 2011-02-24 17:41:19 Re: Changing the Primary Key Column