pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hlefebvre <hlefebvre@lexbase.net>
To: Andreas Tille <tillea@rki.de>
To: PostgreSQL SQL <pgsql-sql@hub.org>
Subject: Re: Re: Date of creation and of change
Date: Wed, 23 Aug 2000 16:35:49 +0200
Message-ID: <39A3E145.55A6F495@lexbase.net> (raw)
References: <Pine.LNX.4.21.0008231541210.22247-100000@wr-linux02.rki.de>



Andreas Tille wrote:

> I tried:
> 
> web=# CREATE FUNCTION changed_at_timestamp () RETURNS OPAQUE AS '
> web'#     BEGIN
> web'#         ChangeDate := timestamp(''now'');
> web'#         RETURN NEW;
> web'#     END;
> web'# ' LANGUAGE 'plpgsql';
> CREATE
> web=# select changed_at_timestamp () ;
> ERROR:  typeidTypeRelid: Invalid type - oid = 0
> web=#
> 
> Is this just the wrong way to test the function?

Yes. The keywords NEW / OLD are available only in triggers
see
http://www.postgresql.org/users-lounge/docs/7.0/user/c40874113.htm#AEN4286

> As a beginner I try to validate each new step I do and so I wonder
> if I insert the Trigger you mentioned
> 
> > CREATE TRIGGER myt_stamp BEFORE INSERT OR UPDATE ON mytable
> >     FOR EACH ROW EXECUTE PROCEDURE myt_stamp();
> 
> the function could cause errors.
> 
> Sorry, I'm not very familiar with this function stuff :-(.
> 
> Kind regards
> 
>           Andreas.



view thread (15+ messages)  latest in thread

Message-ID: <39A3E145.55A6F495@lexbase.net>
Permalink:  ../39A3E145.55A6F495@lexbase.net/
Also on:    postgresql.org/message-id/39A3E145.55A6F495@lexbase.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: hlefebvre@lexbase.net, tillea@rki.de, pgsql-sql@hub.org
  Subject: Re: Date of creation and of change
  In-Reply-To: <39A3E145.55A6F495@lexbase.net>
  References: <Pine.LNX.4.21.0008231541210.22247-100000@wr-linux02.rki.de> <39A3E145.55A6F495@lexbase.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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