[pg-sql] - Problem with duplicate table (PostgreSQL 7.2.3

Lists: pgsql-sql
From: BenLaKnet <benlaknet(at)icqmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: [pg-sql] - Problem with duplicate table (PostgreSQL 7.2.3
Date: 2003-08-08 08:13:59
Message-ID: 3F335BC7.7070800@icqmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

I have to duplicate a table to save different instances of datas.

Structure de la table "spectacle"
-------------------------------------------------------- */
CREATE TABLE "spectacle" (
id_spectacle SERIAL,
"id_membre_adherent" INTEGER NOT NULL,
"id_genre_festival" INTEGER,
"id_festival" INTEGER,
"nom" VARCHAR(255),
"compagnie_interprete" VARCHAR(255),
"vitaculture" INTEGER NOT NULL,
"regionales" INTEGER NOT NULL,
"presentation" TEXT,
"genre_precision" VARCHAR(255),
"duree" VARCHAR(255),
"photo1" VARCHAR(255),
"photo1_credit" VARCHAR(255),
"photo2" VARCHAR(255),
"photo2_credit" VARCHAR(255),
"salle" TEXT,
"tarifs" TEXT,
"id_traitement" INTEGER DEFAULT 1,
"distribution" TEXT,
"type_public" VARCHAR(255),
PRIMARY KEY("id_spectacle"),
FOREIGN KEY ("id_festival") REFERENCES "festival"("id_festival")
ON DELETE RESTRICT
ON UPDATE RESTRICT
NOT DEFERRABLE,
FOREIGN KEY ("id_genre_festival") REFERENCES
"genre_festival"("id_genre_festival")
ON DELETE RESTRICT
ON UPDATE RESTRICT
NOT DEFERRABLE,
FOREIGN KEY ("id_membre_adherent") REFERENCES
"membre_adherent"("id_membre_adherent")
ON DELETE CASCADE
ON UPDATE RESTRICT
NOT DEFERRABLE,
FOREIGN KEY ("id_traitement") REFERENCES "traitement"("id_traitement")
ON DELETE RESTRICT
ON UPDATE RESTRICT
NOT DEFERRABLE
) WITH OIDS;

CREATE INDEX "adherant_spectacle_fk" ON "spectacle"
USING btree ("id_membre_adherent");

CREATE INDEX "genre_spectacle_fk" ON "spectacle"
USING btree ("id_genre_festival");

CREATE INDEX "spectacle_au_festival_fk" ON "spectacle"
USING btree ("id_festival");

When I duplicate this code in an other table named spectacle_v without
Foreygn key ... all is running.

But when I try to delete a spectacle_membre, linked value in spectacle
are correctly deleted, but I have an error for spectacle_v which is not
linked :

(ERROR: referential integrity violation - key in membre_adherent still
referenced from spectacle_v )

I do not understand this message error, because any foreign key is
referenced with this table.


From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: BenLaKnet <benlaknet(at)icqmail(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [pg-sql] - Problem with duplicate table (PostgreSQL 7.2.3
Date: 2003-08-08 15:52:30
Message-ID: 20030808085155.V71867-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

On Fri, 8 Aug 2003, BenLaKnet wrote:

> When I duplicate this code in an other table named spectacle_v without
> Foreygn key ... all is running.
>
> But when I try to delete a spectacle_membre, linked value in spectacle
> are correctly deleted, but I have an error for spectacle_v which is not
> linked :
>
> (ERROR: referential integrity violation - key in membre_adherent still
> referenced from spectacle_v )

What triggers are defined on membre_adherent?


From: Benoît Bournon <benoit(dot)bournon(at)adelis(dot)com>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: BenLaKnet <benlaknet(at)icqmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: [pg-sql] - Problem with duplicate table (PostgreSQL 7.2.3
Date: 2003-08-11 07:07:15
Message-ID: 3F3740A3.4070404@adelis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

No trigger

Just triggers for foreign key in spectacle and none in spectacle_v

How is it possible to verify triggers for foreign keys ?

Stephan Szabo a écrit:

>On Fri, 8 Aug 2003, BenLaKnet wrote:
>
>
>
>>When I duplicate this code in an other table named spectacle_v without
>>Foreygn key ... all is running.
>>
>>But when I try to delete a spectacle_membre, linked value in spectacle
>>are correctly deleted, but I have an error for spectacle_v which is not
>>linked :
>>
>>(ERROR: referential integrity violation - key in membre_adherent still
>>referenced from spectacle_v )
>>
>>
>
>What triggers are defined on membre_adherent?
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>
>


From: BenLaKnet <benlaknet(at)icqmail(dot)com>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [pg-sql] - Problem with duplicate table (PostgreSQL 7.2.3
Date: 2003-08-11 07:23:04
Message-ID: 3F374458.3000207@icqmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

No trigger

Just triggers for foreign key in spectacle and none in spectacle_v

How is it possible to verify triggers for foreign keys ?

Stephan Szabo a écrit:

>On Fri, 8 Aug 2003, BenLaKnet wrote:
>
>
>
>>When I duplicate this code in an other table named spectacle_v without
>>Foreygn key ... all is running.
>>
>>But when I try to delete a spectacle_membre, linked value in spectacle
>>are correctly deleted, but I have an error for spectacle_v which is not
>>linked :
>>
>>(ERROR: referential integrity violation - key in membre_adherent still
>>referenced from spectacle_v )
>>
>>
>
>What triggers are defined on membre_adherent?
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>
>


From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Benoît Bournon <benoit(dot)bournon(at)adelis(dot)com>
Cc: BenLaKnet <benlaknet(at)icqmail(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [pg-sql] - Problem with duplicate table (PostgreSQL 7.2.3
Date: 2003-08-11 13:14:58
Message-ID: 20030811061208.T72304-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql


On Mon, 11 Aug 2003, [ISO-8859-1] Benot Bournon wrote:

> No trigger
>
> Just triggers for foreign key in spectacle and none in spectacle_v
>
> How is it possible to verify triggers for foreign keys ?

Generally a select on pg_trigger. Each foreign key should have 3
triggers, 1 on the referencing table and 2 on the referenced. You find the
tables involved by crossreferencing tgrelid against the oid of the row
in pg_class.

Can you send the results of a pg_dump -s?


From: Benoît Bournon <benoit(dot)bournon(at)adelis(dot)com>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: BenLaKnet <benlaknet(at)icqmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: [pg-sql] - Problem with duplicate table (PostgreSQL 7.2.3
Date: 2003-08-11 13:40:46
Message-ID: 3F379CDE.2000602@adelis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

we make a dump before ... and with a product pgmanager (ems tech) we do
not show any foreign keys.

But I think all of triggers of referenced table are not deleted.

We recreate the schemas ... and now is running.

How is it possible to identify Triggers with no referenced tables ?

Stephan Szabo a écrit:

>On Mon, 11 Aug 2003, [ISO-8859-1] Beno?t Bournon wrote:
>
>
>
>>No trigger
>>
>>Just triggers for foreign key in spectacle and none in spectacle_v
>>
>>How is it possible to verify triggers for foreign keys ?
>>
>>
>
>Generally a select on pg_trigger. Each foreign key should have 3
>triggers, 1 on the referencing table and 2 on the referenced. You find the
>tables involved by crossreferencing tgrelid against the oid of the row
>in pg_class.
>
>Can you send the results of a pg_dump -s?
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>
>