Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group