Re: Changing the Primary Key Column

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pdxpug(at)postgresql(dot)org
Subject: Re: Changing the Primary Key Column
Date: 2011-02-24 14:20:32
Message-ID: alpine.LNX.2.00.1102240617360.4006@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

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'
^
nevada=#

Must be user error; I don't see the variables quoted on the alter table
doc page, but that makes no difference:

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 "not"
LINE 1: alter table water_well drop constraint not null
^
nevada=#

Schema's unchanged:

Table "public.water_well"
Column | Type | Modifiers
--------------------+-----------------------+-----------
sequence_no | text | not null
well_log | text |

Elucidation needed.

Thanks,

Rich

In response to

Responses

Browse pdxpug by date

  From Date Subject
Next Message Brian Kurle 2011-02-24 15:14:35 Re: Changing the Primary Key Column
Previous Message Rich Shepard 2011-02-24 01:23:06 Re: Changing the Primary Key Column