Re: Insert zero to auto increment serial column - Mailing list pgsql-general

From Andrew Sullivan
Subject Re: Insert zero to auto increment serial column
Date
Msg-id 20140402144640.GH56668@crankycanuck.ca
Whole thread Raw
In response to Insert zero to auto increment serial column  (loc <c320sky@gmail.com>)
List pgsql-general
On Wed, Apr 02, 2014 at 08:17:12AM -0400, loc wrote:
> value, MySQL also works this way.  With PostgreSQL I will need to do a lot
> of code modification to my Aubit4GL programs, since I will need to either
> insert with the key word default or omit the serial column in the insert
> statement.

Why don't you put a DO INSTEAD trigger or rule (I'd suggest the
former) when you put in a 0 to do nextval() instead on the sequence
for the column?

Best regards,

A

--
Andrew Sullivan
ajs@crankycanuck.ca


pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Table Vacuum Taking a Long Time
Next
From: "Victor Sterpu"
Date:
Subject: Lock problem