Mike Barrett <mike@daboyz.org> writes:
> The problem here is that no matter what I do, I can't get it to
> just take the default value for id. I've tried leaving a blank, followed
> by a comma as in:
>
> sql=> insert into test values (,'blah');
This was just discussed a week or two ago. The proper syntax is:
INSERT INTO test (name) VALUES ('blah');
> But that errors out. I've messed with using the nextval()
> function, but that seems to run before the actual query is run, so if
> there is an error in the query, my sequence goes to the next value
> anyways. This won't work for me because if the query fails, I don't want
> to have gaps in id #'s.
You *will* have gaps in IDs if you use sequences and have rolled-back
transactions. See the docs and the FAQ.
-Doug
--
Let us cross over the river, and rest under the shade of the trees.
--T. J. Jackson, 1863