From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Yudelsy Castellón García <yude(at)cav(dot)desoft(dot)cu> |
Cc: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: funcion... |
Date: | 2009-08-11 15:25:47 |
Message-ID: | 20090811152547.GA16362@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Yudelsy Castellón García escribió:
> Hola comunidad,
> Necesito saber si en postgres existe alguna función que devuelva en php el
> último id insertado en una tabla. En mysql se puede obtener usando la
> función last_insert_id.
Si tienes el nombre de la tabla y el nombre de la columna, puedes usar
las funciones de Postgres currval() y pg_get_serial_sequence(). Lo de
RETURNING que te recomendaron es lo más fácil.
--
Alvaro Herrera http://www.amazon.com/gp/registry/CTMLCN8V17R4
<inflex> really, I see PHP as like a strange amalgamation of C, Perl, Shell
<crab> inflex: you know that "amalgam" means "mixture with mercury",
more or less, right?
<crab> i.e., "deadly poison"
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2009-08-11 15:27:17 | Re: Ejecutar un conjunto de scripts sin detenerse en un error... |
Previous Message | Manuel Diego | 2009-08-11 14:11:33 | Re: funcion... |