pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedhelp: triggers
3+ messages / 2 participants
[nested] [flat]
* help: triggers
@ 2003-01-29 13:29 Tony Simbine <jantos-work@mvweb.de>
0 siblings, 1 reply; 3+ messages in thread
From: Tony Simbine @ 2003-01-29 13:29 UTC (permalink / raw)
To: pgsql-sql
hello,
I'm trying to update a columm on a table with a trigger
but it don't work on PostgreSQL 7.2 (i686-pc-linux-gnu, compiled by GCC
2.96).
when I update a row the trigger does nothing.
what can I do?
thanks in advance
tony
here is my trigger:
########################################################
CREATE FUNCTION update_my_objekt() RETURNS OPAQUE AS '
BEGIN
RAISE NOTICE ''My Trigger is updating the table'';
IF OLD.status=''Activo'' THEN
NEW.tempo := 10;
NEW.actual := now();
END IF;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';
CREATE TRIGGER update_online BEFORE UPDATE ON iobjects
FOR EACH ROW EXECUTE PROCEDURE update_my_objekt();
##########################################################
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: help: triggers
@ 2003-01-29 15:55 Wei Weng <wweng@kencast.com>
parent: Tony Simbine <jantos-work@mvweb.de>
0 siblings, 1 reply; 3+ messages in thread
From: Wei Weng @ 2003-01-29 15:55 UTC (permalink / raw)
To: Tony Simbine <jantos-work@mvweb.de>; pgsql-sql
It would be better if you could provide the source of that trigger and involved
table schemas?
Wei
----- Original Message -----
From: "Tony Simbine" <jantos-work@mvweb.de>
To: <pgsql-sql@postgresql.org>
Sent: Wednesday, January 29, 2003 8:29 AM
Subject: [SQL] help: triggers
> hello,
>
> I'm trying to update a columm on a table with a trigger
> but it don't work on PostgreSQL 7.2 (i686-pc-linux-gnu, compiled by GCC
> 2.96).
>
> when I update a row the trigger does nothing.
> what can I do?
>
> thanks in advance
>
> tony
>
>
> here is my trigger:
>
> ########################################################
> CREATE FUNCTION update_my_objekt() RETURNS OPAQUE AS '
> BEGIN
> RAISE NOTICE ''My Trigger is updating the table'';
> IF OLD.status=''Activo'' THEN
> NEW.tempo := 10;
> NEW.actual := now();
> END IF;
> RETURN NEW;
> END;
> ' LANGUAGE 'plpgsql';
>
>
> CREATE TRIGGER update_online BEFORE UPDATE ON iobjects
> FOR EACH ROW EXECUTE PROCEDURE update_my_objekt();
>
> ##########################################################
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: help: triggers
@ 2003-01-30 08:20 Tony Simbine <jantos-work@mvweb.de>
parent: Wei Weng <wweng@kencast.com>
0 siblings, 0 replies; 3+ messages in thread
From: Tony Simbine @ 2003-01-30 08:20 UTC (permalink / raw)
To: Wei Weng <wweng@kencast.com>; +Cc: pgsql-sql
Wei Weng wrote:
> It would be better if you could provide the source of that trigger and involved
> table schemas?
>
CREATE SEQUENCE "iobjects_id_seq" start 1 increment 1 maxvalue
9223372036854775807 minvalue 1 cache 1;
GRANT ALL on "iobjects_id_seq" to "jantos";
CREATE TABLE "iobjects" (
"id" integer DEFAULT nextval('"iobjects_id_seq"'::text) NOT NULL,
"status" character varying(10) DEFAULT 'Activo' NOT NULL,
"local" character varying(80) NOT NULL,
"fig_1" character varying(80),
"fig_2" character varying(80),
"fig_3" character varying(80),
"introduzido" timestamp with time zone DEFAULT now() NOT NULL,
"actual" timestamp with time zone DEFAULT now() NOT NULL,
"tempo" integer DEFAULT 0 NOT NULL,
"deleted" character(1) DEFAULT '0',
Constraint "pk_iobjects" Primary Key ("id")
);
GRANT ALL on "iobjects" to "jantos";
>
> Wei
>
> ----- Original Message -----
> From: "Tony Simbine" <jantos-work@mvweb.de>
> To: <pgsql-sql@postgresql.org>
> Sent: Wednesday, January 29, 2003 8:29 AM
> Subject: [SQL] help: triggers
>
>
>
>>hello,
>>
>>I'm trying to update a columm on a table with a trigger
>>but it don't work on PostgreSQL 7.2 (i686-pc-linux-gnu, compiled by GCC
>>2.96).
>>
>>when I update a row the trigger does nothing.
>>what can I do?
>>
>>thanks in advance
>>
>>tony
>>
>>
>>here is my trigger:
>>
>>########################################################
>>CREATE FUNCTION update_my_objekt() RETURNS OPAQUE AS '
>>BEGIN
>> RAISE NOTICE ''My Trigger is updating the table'';
>> IF OLD.status=''Activo'' THEN
>> NEW.tempo := 10;
>> NEW.actual := now();
>> END IF;
>> RETURN NEW;
>>END;
>>' LANGUAGE 'plpgsql';
>>
>>
>>CREATE TRIGGER update_online BEFORE UPDATE ON iobjects
>> FOR EACH ROW EXECUTE PROCEDURE update_my_objekt();
>>
>>##########################################################
>>
>>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-01-30 08:20 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-29 13:29 help: triggers Tony Simbine <jantos-work@mvweb.de>
2003-01-29 15:55 ` Wei Weng <wweng@kencast.com>
2003-01-30 08:20 ` Tony Simbine <jantos-work@mvweb.de>
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