Re: Empty Updates, ON UPDATE triggers and Rules

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Josh Trutwin <josh(at)trutwins(dot)homeip(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Empty Updates, ON UPDATE triggers and Rules
Date: 2009-08-06 20:58:02
Message-ID: 600DA7A0-A73C-4704-A7C9-0FC52087EC34@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Aug 6, 2009, at 15:31 , Josh Trutwin wrote:

> Interestingly, this syntax is accepted in 8.3.7, but SELECT queries
> fail:
>
> CREATE TRIGGER trigger_test_upd_set_last_mod
> BEFORE UPDATE ON test_upd
> FOR EACH ROW EXECUTE PROCEDURE set_last_modified();
>
> Then:
>
> UPDATE test_upd SET foo = 'foo' WHERE id = 1;
> ERROR: operator does not exist: test_upd <> test_upd
> LINE 1: SELECT $1 != $2
> ^
> HINT: No operator matches the given name and argument type(s). You
> might need to add explicit type casts. QUERY: SELECT $1 != $2
> CONTEXT: PL/pgSQL function "set_last_modified_test" line 2 at IF

That's not a SELECT query per se: AIUI it's how the evaluation of the
NEW != OLD expression is evaluated within the PL/pgSQL function as
part of the IF statement (note the "line 2 at IF" context line). It's
just saying the <> operator doesn't exist for the test_upd rowtype.

Michael Glaesemann
grzm seespotcode net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Rogers 2009-08-06 21:19:18 Foreign Key Deferrable Misunderstanding or Bug?
Previous Message Josh Trutwin 2009-08-06 19:31:48 Re: Empty Updates, ON UPDATE triggers and Rules