'Insert default value for serial type auto incrementation column
I defined an attribute in my table of type serial4, so when I insert a new row, the attribute is automatically incremented:
myTable (id serial4, name varchar(25), whatever whatever, ...);
To insert a new entry, I just strip off the id attribute in the association list:
insert into myTable (name, whatever, ...) values ('foo', ...);
Now, if my table has a large number of attributes, the association list is exhausting to write.
I just want to write:
insert into myTable values (...);
But if the first attribute of myTable is the serial4 id. What should I write in the VALUES list to get the id being incremented +1 from the last inserted value?
insert into myTable values (?, 'foo', ...);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
