Re: Help on some SQL command...

From: Jesus Aneiros <aneiros(at)jagua(dot)cfg(dot)sld(dot)cu>
To: Ang Sei Heng <joanna(at)leopard(dot)cybersource(dot)com(dot)sg>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Help on some SQL command...
Date: 2000-08-17 12:44:51
Message-ID: Pine.LNX.4.10.10008170844390.11053-100000@jagua.cfg.sld.cu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Use default now()

--
Jesus Aneiros Sosa
mailto:aneiros(at)jagua(dot)cfg(dot)sld(dot)cu
http://jagua.cfg.sld.cu/~aneiros

On Wed, 16 Aug 2000, Ang Sei Heng wrote:

> Hello to all the SQL gurus...
>
> I have this little table:
>
> test1 (
> id char(8) primary key,
> name char(20),
> create_date timestamp
> );
>
> Now, the create_date need to be updated
> to date and time whenever id is being
> inserted or updated.
>
> Is there a way in SQL that I can do this
> automatically?
>
> I try the following command using 'trigger'
>
> ----
> CREATE_TRIGGER test1_autodate
> AFTER INSERT OR UPDATE ON
> test1 FOR EACH ROW EXECUTE update("test1")
>
> CREATE FUNCTION update(char *) RETURNS int4
> AS 'UPDATE $1 set date="now"'
> LANGUAGE 'sql';
> ----
>
> But realized 'char *' is not allow... Is there a
> way to solve this?
>
> Or Am I the right track in solving this problem?
>
> Hope someone can help me... thanks.
>
> Sei Heng
>
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jerome Raupach 2000-08-17 13:23:12 optimization in C
Previous Message Maarten Boekhold 2000-08-17 11:55:19 Re: car mileage summation / sledgehammer method