Search Postgresql Archives

Re: Trigger problem, record "new" is not assigned yet

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

 



On Thu, Feb 10, 2011 at 9:38 AM, A B <gentosaker@xxxxxxxxx> wrote:
> CREATE TRIGGER trigger_foo BEFORE INSERT ON foo for each row EXECUTE
> PROCEDURE trigger_foo();
>
> gives me the same error.
>

Maybe "NEW" needs to be all caps?  Also, with the BEFORE trigger,
you'll need to RETURN NEW.

This trigger of mine works just fine as a before trigger, FWIW:


CREATE OR REPLACE FUNCTION sessions_update_lastuse() RETURNS TRIGGER
  AS $$
    BEGIN
      NEW.lastuse = CURRENT_TIMESTAMP;
      RETURN NEW;
    END;
$$ LANGUAGE plpgsql;

-- 
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