From: Falk Nisius <falknisius@gmx.de>
To: pgsql-sql@postgresql.org
Subject: How to prevent recursion
Date: Tue, 20 Aug 2002 10:07:26 +0200
Message-ID: <NEBBJJEAELOFDDMFKJJFEEFJDIAA.falknisius@gmx.de> (raw)
Hi,
I try to save hierarchical Data with an
id that contains strings which represent
the way through the tree. On each depth level
I can have a maxcount number of elements.
If I want move subtrees, I have to change these
id-fields. I want implement this as a RULE in the
Database, that the using application not have to
call any SQL statements in a sequence.
I tried:
CREATE RULE hangup AS
ON UPDATE TO "products"
WHERE OLD."id" != NEW."id"
DO INSTEAD
UPDATE "products" SET "id"=NEW."id" ||
substring("id",char_length(OLD."id")+1) WHERE "id" LIKE (OLD."id" || '~')
That runs definitely in recursion, and I have no idea to prevent
this. Perhaps it runs with triggers and/or Functions.
Thank for your help
Falk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: falknisius@gmx.de
Subject: Re: How to prevent recursion
In-Reply-To: <NEBBJJEAELOFDDMFKJJFEEFJDIAA.falknisius@gmx.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox