From: | Terry Lee Tucker <terry(at)esc1(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Common question: what's wrong |
Date: | 2005-01-15 13:55:59 |
Message-ID: | 200501150855.59342.terry@esc1.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I believe that if you want the default value in new.id_oferta, then do
nothing. If the value is not set, the default will be applied. I don't think
you can do it the way you are tying to.
On Thursday 13 January 2005 08:32 am, przygoda(at)klub(dot)chip(dot)pl saith:
> This is a trigger function:
>
> CREATE FUNCTION public.trigger_null2default() RETURNS trigger AS 'BEGIN
> IF TG_RELNAME = ''g_oferty'' THEN
> IF NEW.id_oferta ISNULL THEN
> NEW.id_oferta = DEFAULT ;
> END IF;
> END IF;
> RETURN NEW;
> END;' LANGUAGE 'plpgsql' IMMUTABLE;
>
> There is an error near DEFAULT when firing trigger (on insert)
> How can I set defaults without doing INSERT INTO 'g_oferta' (DEFAULT,
> NEW...?
>
> Martin
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
--
Work: 1-336-372-6812
Cell: 1-336-363-4719
email: terry(at)esc1(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Hadi Saboohi | 2005-01-16 07:35:43 | Get DB Structure |
Previous Message | John DeSoi | 2005-01-15 13:37:57 | Re: Common question: what's wrong |