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

auto-increment integer field for each row

From: Lonni J Friedman <netllama(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: auto-increment integer field for each row
Date: 2009-12-03 22:39:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I'm trying to create a trigger which will auto-increment the integer
stored in one of the 'not null' table rows each time that row is

I tried to use the trigger example here, but it silently fails to work:

I can repeatedly update column 'b' in the table of that example, and
'a' will remain '1'.

I'm guessing that maybe plpgsql has changed sufficiently since that
example was written (almost 10! years ago), that its no longer
compatible with the version (8.1.10) that I'm using.

many thanks for any advice/pointers.



pgsql-novice by date

Next:From: Tom LaneDate: 2009-12-03 22:56:06
Subject: Re: auto-increment integer field for each row
Previous:From: Kris KewleyDate: 2009-12-03 00:46:57
Subject: Re: initdb fails in win xp

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