Re: How to change primary key in a table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rikard Bosnjakovic <rikard(dot)bosnjakovic(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: How to change primary key in a table
Date: 2009-11-12 15:15:57
Message-ID: 24459.1258038957@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Rikard Bosnjakovic <rikard(dot)bosnjakovic(at)gmail(dot)com> writes:
> I tried this:

> ========================================
> SQL error:
> ERROR: cannot drop constraint penalty_codes_pkey on table
> penalty_codes because other objects depend on it
> HINT: Use DROP ... CASCADE to drop the dependent objects too.

> In statement:
> ALTER TABLE "penalty_codes" DROP CONSTRAINT "penalty_codes_pkey"
> ========================================

The system will normally tell you exactly what depends on the
constraint. 8.4 includes this in a DETAIL line, but prior releases
spit it out as separate NOTICE message(s). I surmise that you are
running a pre-8.4 release and you have client_min_messages set to
suppress NOTICEs :-(

(Offhand I can't think of anything except foreign keys that would
depend on a PK constraint, but you may as well get the authoritative
statement from your DB.)

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Lynn Manhart 2009-11-13 00:29:18 using position in where
Previous Message Tom Lane 2009-11-12 14:44:09 Re: CRC protection of data?