Skip site navigation (1) Skip section navigation (2)

Re: Common question: what's wrong

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: (view raw, whole thread or download thread mbox)
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;
> 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?

 Work: 1-336-372-6812
 Cell: 1-336-363-4719
email: terry(at)esc1(dot)com

In response to

pgsql-novice by date

Next:From: Hadi SaboohiDate: 2005-01-16 07:35:43
Subject: Get DB Structure
Previous:From: John DeSoiDate: 2005-01-15 13:37:57
Subject: Re: Common question: what's wrong

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group