Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the difference between these two ways PostgreSQL)?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic