This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 3476

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)?
 
Similar Threads
How are sessions created in struts?
Java Beans and JSP
Error while inserting data into from a JSP Page
attributes and paramters
. java.lang.IllegalArgumentException: callable not yet supported for native queries