pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Tille <tillea@rki.de>
Cc: PostgreSQL SQL <pgsql-sql@hub.org>
Subject: Re: Date of creation and of change
Date: Wed, 23 Aug 2000 15:44:12 +0200 (CEST)
Message-ID: <Pine.LNX.4.21.0008231541210.22247-100000@wr-linux02.rki.de> (raw)
In-Reply-To: <39A3A9EB.E6AF09D5@lexbase.net>

On Wed, 23 Aug 2000, hlefebvre wrote:

> create table mytable( CreateDate  timestamp default timestamp('now'),
> ....);  
Thanks, this works.
 
> CREATE FUNCTION myt_stamp () RETURNS OPAQUE AS
>     BEGIN
>         ChangeDate := timestamp(''now'');
>         RETURN NEW;
>     END;
> ' LANGUAGE 'plpgsql';
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?
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: <Pine.LNX.4.21.0008231541210.22247-100000@wr-linux02.rki.de>
Permalink:  ../Pine.LNX.4.21.0008231541210.22247-100000@wr-linux02.rki.de/
Also on:    postgresql.org/message-id/Pine.LNX.4.21.0008231541210.22247-100000@wr-linux02.rki.de

 · 

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: tillea@rki.de, pgsql-sql@hub.org
  Subject: Re: Date of creation and of change
  In-Reply-To: <Pine.LNX.4.21.0008231541210.22247-100000@wr-linux02.rki.de>
  References: <39A3A9EB.E6AF09D5@lexbase.net> <Pine.LNX.4.21.0008231541210.22247-100000@wr-linux02.rki.de>

* 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