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

Re: Last inserted id

From: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
To: "'Simeo Reig'" <simreig(at)terra(dot)es>
Cc: "'pgsql-odbc(at)postgresql(dot)org'" <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Last inserted id
Date: 2001-11-12 08:23:08
Message-ID: AA30E7BCCA5C1D4E88A231900F8325C00C70@dogbert.vale-housing.co.uk (view raw or flat)
Thread:
Lists: pgsql-odbc

> -----Original Message-----
> From: Simeo Reig [mailto:simreig(at)terra(dot)es] 
> Sent: 11 November 2001 22:54
> To: Dave Page
> Subject: Re: [ODBC] Last inserted id
> 
> 
> I had think that the problem was this but I believed that
> was possible to make a mistake because I'm newer with
> ADO. What must I do ? I see two possibilities:
> 
>  A) Make a select NEXTVAL from sequence, and
>       insert this value in the id
> 
>   B) Insert row and after make a CURRVAL
> 
> What option Do you use ?

Use option A), it's multi-user safe whereas the other method isn't.
 
> 
> Another question please : Are you pleased with Postgres ?
> I have to make a project with almost 50 tables (five with 
> arround 100.000 rows), and 20 concurrent users. Can postgres 
> make a good job?

I'm project lead for pgAdmin II (pgadmin.postgresql.org) so I'm probably a
bit biased :-) but the main server I run at work hosts about 12 databases
for interactive (VB) applications, PHP apps and also logs data from 3 PBXs.
Most of the databases have at least 10 tables in them (a couple have about
40) and I have some tables over 1.7 million rows. In short, PostgreSQL does
a great job for me and I use it wherever I can (incidently, I also have
Informix, MS-SQL & Unidata servers here which I could have used instead of
PostgreSQL).

Regards, Dave.


> Thanks Dave
> 
> SimeĆ³ Reig
> Barcelona (Spain)
> 
> > ADO doesn't re-query the database to get the true 
> >representation of 
> > the
> new
> > row. The common way around this problem is to manually >get 
> the new ID
> first
> > in a seperate query, and then insert that value as well. The >other 
> > alternative is to refresh the recordset after the insert, >however 
> > this
> often
> > isn't desirable.
> >
> > Regards, Dave.
> 
> 
> 

Responses

pgsql-odbc by date

Next:From: Geoffrey D. BennettDate: 2001-11-12 08:55:04
Subject: Re: Last inserted id
Previous:From: Bruce MomjianDate: 2001-11-12 01:49:57
Subject: Re: [ODBC] MD5 support for ODBC

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