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

Re: auto fill the missing numbers

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Greg Nissen <gnissen(at)geicp(dot)com>, pgsql-odbc(at)postgresql(dot)org
Subject: Re: auto fill the missing numbers
Date: 2007-01-10 01:54:15
Message-ID: 799740.32678.qm@web31815.mail.mud.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-odbc
> ms access already had some 57000 transaction loaded into the old database,
> when i linked to postgres using the ODBC driver, all these transaction came
> over, as excepted, but when i create a new record now, the database is
> filling in all the missing numbers prior to 57000, which jumbles up my
> record table. How can i get the postgres database to start off from 57001

I assume that by transaction you mean record I assume that you are using serial or big serial as
the autonumber for your new postgresql tables.

1) you need to determine the table_sequence name that was created for you table.
2) change the table_sequence value to one greater than the values already stored in the table from
access.

The function you need it setval()
http://www.postgresql.org/docs/8.2/interactive/functions-sequence.html

you can use setval() useing the psql client utility to postgresql.

Regards,
Richard Broersma Jr.

In response to

pgsql-odbc by date

Next:From: Grahame JordanDate: 2007-01-10 10:42:06
Subject: Re: ODBC and Boolean
Previous:From: Joshua D. DrakeDate: 2007-01-10 01:49:31
Subject: Re: auto fill the missing numbers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group