my dog learned polymorphism*
The moose likes JDBC and the fly likes What is the difference between these two ways PostgreSQL)? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "What is the difference between these two ways PostgreSQL)?" Watch "What is the difference between these two ways PostgreSQL)?" New topic
Author

What is the difference between these two ways PostgreSQL)?

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hi.
What is the difference between:
insert into agents (id, username, password) values (default, '....', '....')
and
insert into agents (id, username, password) values (nextval('agents_seq'), '....', '....')
Where id column is auto increment (sequence)?
When to use each one?
Thanks.
Greg Bugaj
Greenhorn

Joined: May 19, 2008
Posts: 3
If I am not mistaken nextval('sequence name') will give you next available sequance number using specific sequence name, while the 'default' option will use the default associated sequence.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the difference between these two ways PostgreSQL)?