Thread: What is the postgres sql command for last_user_id ???

What is the postgres sql command for last_user_id ???

From
amrit@health2.moph.go.th
Date:
I would like to know whether there is any command which the server will give the
record ID back to the client when client puts the data and the server generates
an autoincrement ID for that record.
For example if many clients try to put the money data to the server and each
record from each client has its own record ID by autoincrement process of the
server [x+1] and i don't need to lock the record since it will bring the system
to slow down. That client wil then want to know which ID that server gives to
that record in order to select that record to print the reciept [bill].
I know that in mysql there is a command "last_record_id" which acts the same as
I mention above. Does anybody know that , please give me the detail?

Amrit,Thailand



Re: What is the postgres sql command for last_user_id ???

From
Michael Fuhr
Date:
On Tue, Mar 01, 2005 at 10:46:02PM +0700, amrit@health2.moph.go.th wrote:

> I would like to know whether there is any command which the server will give the
> record ID back to the client when client puts the data and the server generates
> an autoincrement ID for that record.

See "How do I get the value of a SERIAL insert?" and the question
immediately following it in the FAQ:

http://www.postgresql.org/files/documentation/faqs/FAQ.html#4.11.2

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re: What is the postgres sql command for last_user_id ???

From
stig erikson
Date:
amrit@health2.moph.go.th wrote:
> I would like to know whether there is any command which the server will give the
> record ID back to the client when client puts the data and the server generates
> an autoincrement ID for that record.
> For example if many clients try to put the money data to the server and each
> record from each client has its own record ID by autoincrement process of the
> server [x+1] and i don't need to lock the record since it will bring the system
> to slow down. That client wil then want to know which ID that server gives to
> that record in order to select that record to print the reciept [bill].
> I know that in mysql there is a command "last_record_id" which acts the same as
> I mention above. Does anybody know that , please give me the detail?
>
> Amrit,Thailand
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

http://www.postgresql.org/docs/8.0/static/functions-sequence.html