Inserting and incrementing with MAX aggregate - Mailing list pgsql-sql

From Keith Perry
Subject Inserting and incrementing with MAX aggregate
Date
Msg-id 3A6DE314.A85DEEB0@vcsn.com
Whole thread Raw
List pgsql-sql
I was wondering if this statement was still supported in 7.0.x versions
of pgSQL.  I upgraded from a 6.x version where say:

insert into events (eid,name) values (max(eid)+1,'server down');

works but not in the 7.x variants.

I know that I could use the serial type for that column but in the
interest not having to rewrite the code (or dump, drop and recreate the
tables/data), I wanted  to know if there was a more stand way to
incrementing a field automatically that would be fairly portable.  Any
help would be appreciated.

Keith Perry
VCSN Inc.
keith@vcsn.com
http://vcsn.com


pgsql-sql by date:

Previous
From: "PM"
Date:
Subject: Re: Joining several tables
Next
From: Oleg Bartunov
Date:
Subject: help with query