Trigger problem

From: "Vladimir Manic" <mancha(at)hotpop(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Trigger problem
Date: 2003-01-29 14:38:13
Message-ID: 3E37F565.29052.1743695@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have table anda data like this:

CREATE TABLE "aa" (
"id" serial,
"d" bool DEFAULT 'f'::bool NOT NULL,
"nid" int4
);

INSERT INTO "aa" ("id", "d", "nid") VALUES(1, 'f', 1);
INSERT INTO "aa" ("id", "d", "nid") VALUES(2, 'f', 1);
INSERT INTO "aa" ("id", "d", "nid") VALUES(3, 'f', 2);
INSERT INTO "aa" ("id", "d", "nid") VALUES(4, 't', 1);

My goal is:
when I update record id=2 and set d='t',
I want to set all other records field d to 'f' where field nid contains the same
value as updated record.
In this situation I should set d to 'f' in record id=4

Any idea?

. Vladimir Manic, dipl. ing
. manix(at)eunet(dot)yu
. manix(at)pakom(dot)co(dot)yu
. ICQ:23561543

Responses

Browse pgsql-general by date

  From Date Subject
Next Message William WAISSE 2003-01-29 14:40:44 Re: Unsubscribe
Previous Message SZŰCS Gábor 2003-01-29 14:33:26 numeric usernames in 7.3.1?