X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 08711D1D174 for ; Wed, 14 Apr 2004 22:56:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 97148-01 for ; Wed, 14 Apr 2004 22:56:00 -0300 (ADT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id 2DA36D1E2C9 for ; Wed, 14 Apr 2004 22:55:56 -0300 (ADT) Received: (qmail 7753 invoked from network); 15 Apr 2004 01:55:59 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 15 Apr 2004 01:55:59 -0000 From: "Greg Sabino Mullane" To: pgsql-admin@postgresql.org Subject: Re: sequence value of the record just inserted / DBI X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: Date: Thu, 15 Apr 2004 01:55:59 -0000 X-Mailer: JoyMail 1.47 Message-ID: <56a7cf851d9fbfa413405b6ef7defbda@biglumber.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/224 X-Sequence-Number: 13197 -----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-----