Re: request for advise

From: "Brian Hirt" <bhirt(at)mobygames(dot)com>
To: "Stephan Szabo" <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>, "Brian A Hirt" <bhirt(at)berkhirt(dot)com>
Subject: Re: request for advise
Date: 2001-11-05 15:44:19
Message-ID: 004701c16610$efb1c780$640b0a0a@berkhirt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephan,

Thanks for the reply. The ON DELETE CASCADE does the opposite of what i
want. ie, you delete a primary key, and the foriegn key is deleted. In my
sample, you are deleting the foriegn key, not the primary key.

The function i included in the original message does select into a variable
and it does delete the list row, but if the list has a next_id and the
function is called recursively, that's when i get a stmt_execsql error.

--brian

----- Original Message -----
From: "Stephan Szabo" <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: "Brian Hirt" <bhirt(at)mobygames(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>; "Brian A Hirt" <bhirt(at)berkhirt(dot)com>
Sent: Monday, November 05, 2001 10:02 AM
Subject: Re: [GENERAL] request for advise

> On Mon, 5 Nov 2001, Brian Hirt wrote:
>
> > Hello,
> >
> > I'm looking for people's opinions on what would be the best way to
delete
> > some rows in one table, when the row referencing them in another table
is
> > deleted. The relationship of the objects is one-to-one. IE, you will
never
>
> I'm assuming that you've tried adding a ON DELETE CASCADE to the
> references constraints and had that fail, right?
>
> > have more than one foriegn key for each primary key. My example
contains
> > two tables; 'list' and 'sample' The 'list' table is a linked list of
> > records, and 'sample' is another record that contains a pointer to the
head
> > of a list. When a row is deleted from 'sample' I want all of the rows
from
> > 'list' deleted that part of the list. Some things to note, are that
the
> > list has to be deleted in reverse order to avoid RI errors; and I'm not
sure
> > about pgsql's ability to run recursively. I tried writing a function to
> > recursively delete the list but it fails with "ERROR: unexpected SELECT
> > query in exec_stmt_execsql()"
>
> I think you need to SELECT into a variable, so probably something like
> SELECT INTO tmpresult ...; and a tmpresult variable may do it.
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Johnson, Shaunn 2001-11-05 15:48:01 postgres copy command
Previous Message Bruce Momjian 2001-11-05 15:40:29 Re: Got error on CREATE TABLE AS (+Bug?)