Re: Common question: what's wrong

Поиск
Список
Период
Сортировка
От Terry Lee Tucker
Тема Re: Common question: what's wrong
Дата
Msg-id 200501150855.59342.terry@esc1.com
обсуждение исходный текст
Ответ на Common question: what's wrong  (przygoda@klub.chip.pl)
Список 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@klub.chip.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@esc1.com

В списке pgsql-novice по дате отправления:

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: Common question: what's wrong
Следующее
От: "Hadi Saboohi"
Дата:
Сообщение: Get DB Structure