Re: writing a function to mimic mysql last_insert_id

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Beth Gatewood" <beth(at)vizxlabs(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: writing a function to mimic mysql last_insert_id
Date: 2002-09-12 02:05:00
Message-ID: GNELIHDDFBOCMGBFGEFOGEDDCEAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

But in Postgres, you can have as many "autoincrement" columns in a table as
you want - how will you handle that?

And what's wrong with select currval()?

Chris

> I am wondering if I can get some input on the logic that I would need to
> code a function that would mimic mysql's last_insert_id()..
>
> Here is what last_insert_id() does in mysql:
> Returns the last automatically generated value that was inserted into an
> AUTO_INCREMENT column.
> mysql> SELECT LAST_INSERT_ID();
> -> 195

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Chris 2002-09-12 02:21:49 Re: writing a function to mimic mysql last_insert_id
Previous Message Ricardo Javier Aranibar León 2002-09-11 20:02:23 reset sequence