automatic insert of next sequence value? - Mailing list pgsql-general

From J B Bell
Subject automatic insert of next sequence value?
Date
Msg-id 20001012101125.A6159@staff.intergate.ca
Whole thread Raw
In response to Re[2]: Comments on earlier age() post.  (Jean-Christophe Boggio <cat@thefreecat.org>)
Responses Re: automatic insert of next sequence value?  (Alfred Perlstein <bright@wintelcom.net>)
Re: automatic insert of next sequence value?  (<bmccoy@chapelperilous.net>)
List pgsql-general
Hi,

I've recently started with pgsql after having used mysql.  Oddly, a problem
the latter seems to have followed me.

When I set up a field with a default value to use a sequence (with "nextval"),
It doesn't work automatically.  Both using DBI and the pgsql cli, if I do

INSERT INTO foo VALUES (NULL);

or

INSERT INTO foo VALUES ('');

I get an error or null is inserted in the first case, if the field is set
non-null, or a 0 in the second case.

Of course without this, a good part of the convenince of auto-incrementing is
defeated.  I can work around it by looking up the appropriate value, but then
I need to do locking as well, which is likely slower and definitely more
annoying.

Is there some settable option that determines what will cause a default value
to be inserted?  Is this a compile-time option of some sort?  I've been
searching around for a couple of weeks on this, with no luck in the docs.  I
would be very grateful for any assistance.

--JB

--
------------------------------------------------------------------
                J B Bell            |              /~\
          Systems Administrator     |       ASCII  \ /  Against
            Internet Gateway        |      Ribbon   X   HTML
                                    |    Campaign  / \  Mail

pgsql-general by date:

Previous
From: Jean-Christophe Boggio
Date:
Subject: Re[2]: Comments on earlier age() post.
Next
From: Tomas Berndtsson
Date:
Subject: Re: automatic insert of next sequence value?