Fwd: Re: time to integer

From: Soma Interesting <dfunct(at)telus(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Fwd: Re: time to integer
Date: 2001-03-06 20:00:05
Message-ID: 5.0.2.1.0.20010306115739.02b1be10@pop.telus.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I should have mentioned that NEW.id is set to default to nextval('id_seq').

>this is my trigger and function:
>
>CREATE FUNCTION oned_member_num() RETURNS OPAQUE AS '
> BEGIN
> NEW.member_num := NEW.id + date_part('epoch', timestamp
> 'now');
> RETURN new;
> END;'
>LANGUAGE 'plpgsql';
>
>
>CREATE TRIGGER oned_member_num
>BEFORE INSERT
>ON members
>FOR EACH ROW
>EXECUTE PROCEDURE oned_member_num();
>
>I'm not 100% sure that a pl/pgsql function is the best/only solution here.
>Is it overkill, or my only option?

Browse pgsql-general by date

  From Date Subject
Next Message Jie Liang 2001-03-06 20:02:55 Re: [SQL] Date question
Previous Message Ben 2001-03-06 19:56:12 Re: epoch <-> timestamp