pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Sabino Mullane <greg@turnstep.com>
To: pgsql-admin@postgresql.org
Subject: Re: sequence value of the record just inserted / DBI
Date: Thu, 15 Apr 2004 01:55:59 -0000
Message-ID: <56a7cf851d9fbfa413405b6ef7defbda@biglumber.com> (raw)
In-Reply-To: <Pine.GSO.4.10.10404141237550.24800-100000@edsun.coe.tamu.edu>


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
 
> Perl's DBI has the following function.
>
> $rv = $dbh->last_insert_id($catalog, $schema, $table, $field);
> "Returns a value 'identifying' the row just inserted, if possible."
>
> I wonder what this $catalog is in this context. It's supposed to be
> metadata, and CREATE USER has CATALOG|NOCATALOG option, but what would be
> $catalog value for a user table in this context?
 
DBD::Pg does not support last_insert_id yet. It's so new, that none
of the DBDs support it yet. When it is implemented in DBD::Pg, the catalog
option will be ignored, as PostgreSQL has no catalog concept (nor do most
other RDBM systems). You will notice that most of the other DBI functions
have the same $catalog, $schema, $table ... design. In that context,
catalog is meant as a higher-level than the schema: you can think of it
as a collection of schemas.
 
Keep in mind the last_insert_id() function is mostly meant as a portability
helper: unless you are porting your script to other databases, just
use nextval (number 2 in your other email) which is perfectly safe.
 
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200404142155
 
-----BEGIN PGP SIGNATURE-----
 
iD8DBQFAfevzvJuQZxSWSsgRAo1dAJ4s/bYbJjubg9IaC91PlpUF5DFX1wCgxgTa
IMLESlXMRgNm+TLbYFV2+zQ=
=OScZ
-----END PGP SIGNATURE-----





view thread (8+ messages)  latest in thread

Message-ID: <56a7cf851d9fbfa413405b6ef7defbda@biglumber.com>
Permalink:  ../56a7cf851d9fbfa413405b6ef7defbda@biglumber.com/
Also on:    postgresql.org/message-id/56a7cf851d9fbfa413405b6ef7defbda@biglumber.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: greg@turnstep.com
  Subject: Re: sequence value of the record just inserted / DBI
  In-Reply-To: <56a7cf851d9fbfa413405b6ef7defbda@biglumber.com>
  References: <Pine.GSO.4.10.10404141237550.24800-100000@edsun.coe.tamu.edu> <56a7cf851d9fbfa413405b6ef7defbda@biglumber.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox