Search Postgresql Archives

Re: Updating

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Following is the code that gives me the error.

CREATE OR REPLACE FUNCTION monitor_install() RETURNS trigger AS $$
Begin

If NEW.p_id.association.monitoring_fluid is distinct from Old.p_id.association.monitoring_fluid Then

INSERT INTO p_id.devices (device_number)
(Select mon_function from p_id.association, p_id.devices
Where (p_id.association.mon_function <> p_id.devices.device_number
and (p_id.association.monitoring_fluid <> p_id.devices.fluid_id
or p_id.association.monitoring_fluid <>  p_id.devices.pipe_id))
and p_id.association.monitor is null);

  RETURN NULL;
END;

$$ LANGUAGE plpgsql;

create trigger monitorinstall before update on p_id.association
for each row execute procedure monitor_install();



----- Original Message ----- From: "Daniel Verite" <daniel@xxxxxxxxxxxxxxxx>
To: "Bob Pawley" <rjpawley@xxxxxxx>
Cc: "Adrian Klaver" <aklaver@xxxxxxxxxxx>; <pgsql-general@xxxxxxxxxxxxxx>
Sent: Monday, March 17, 2008 2:42 PM
Subject: Re:  Updating


Bob Pawley wrote:

I am attempting to use the following code but I get -
"ERROR: NEW used in query that is not in a rule".

This implies that I create a rule for NEW and OLD (which I haven't
needed
before).

No, but are you sure you're using these keywords in the context of a plpgsql function?
Can you post the entire CREATE statement that fails?

BTW I noticed that Adrian used != . Is this symbol the same as <> ?

Yes it's the same.

Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux