Re: INSERT a number in a column based on other columns OLD INSERTs

From: litu16 <litumelendez(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: INSERT a number in a column based on other columns OLD INSERTs
Date: 2015-06-21 01:07:21
Message-ID: 1434848841968-5854602.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, thanks
yes I was using AFTER, but it only works with BEFORE
so finally I got it to work.
thanks to all

Im just still wondering
why here...

*BEGIN
IF NEW.time_type = 'Start' THEN
SELECT t.time_index FROM table_ebscb_spa_log02 t WHERE t.fn_name =
NEW.fn_name AND t.time_type = 'Start' ORDER BY t.timestamp02 DESC LIMIT 1
INTO t_ix;
GET DIAGNOSTICS n = ROW_COUNT;
IF (n = 0) THEN
t_ix = 1;
ELSE
t_ix = t_ix + 1;
END IF;
END IF;
NEW.time_index = t_ix;
return NEW;
END
$$
LANGUAGE plpgsql;*

I have to put return NEW, instead of NEW.time_index = t_ix????

Thanks to all again.

--
View this message in context: http://postgresql.nabble.com/INSERT-a-number-in-a-column-based-on-other-columns-OLD-INSERTs-tp5854577p5854602.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Charles Clavadetscher 2015-06-21 14:49:24 Re: INSERT a number in a column based on other columns OLD INSERTs
Previous Message Adrian Klaver 2015-06-20 19:48:58 Re: INSERT a number in a column based on other columns OLD INSERTs