Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: I'm very confused.



On Wednesday 17 January 2007 09:54, Brant Fitzsimmons wrote:
> Sean Davis wrote:
> > On Wednesday 17 January 2007 03:06, Brant Fitzsimmons wrote:
> >> Jasbinder Singh Bali wrote:
> >>> Please attach a snippet of your python script and lets see what
> >>> are you doing there. That might make things easy. Jas
> >>
> >> Here is the entire test script:
> >>
> >> #!/usr/bin/python
> >>
> >> # import pgdb module import pgdb
> >>
> >> # connect to the db db = pgdb.connect(host="localhost",
> >> database="test", user="postgres", password="**********")
> >>
> >> # instantiate cursor cursor = db.cursor()
> >>
> >> # insert 10 records for x in range(10): cursor.execute("INSERT
> >> INTO users (username, firstname, lastname, email, age) VALUES
> >> ('brant', 'Brant', 'Fitzsimmons',
> >> 'brant(at)bfcomputerconsulting(dot)com', 31)")
> >
> > Put in a db.commit() statement here.  Does that fix your problem?
>
> It sure does.  Any idea why it would drive up the serial column even
> though nothing was committed?

Great to hear....

A serial column is a macro to make a sequence and then to fill the column with 
the default "next_val" from the sequence.  The mere selection of next_val 
increases the sequence, which is necessary to ensure that all connections get 
a unique value when selecting from the same sequence.  

Sean



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group