Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6CCDC476B41 for ; Thu, 19 Sep 2002 12:47:06 -0400 (EDT) Received: from hera.telvia.it (hera.telvia.it [213.155.209.7]) by postgresql.org (Postfix) with ESMTP id 438DB476917 for ; Thu, 19 Sep 2002 12:47:03 -0400 (EDT) Received: from black (unverified [213.155.201.134]) by hera.telvia.it (Vircom SMTPRS 5.3.228) with SMTP id for ; Thu, 19 Sep 2002 18:45:05 +0200 From: "Sebastiano Cascione" To: Subject: transaction in postgres Date: Thu, 19 Sep 2002 18:37:48 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2776.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/41 X-Sequence-Number: 1496 Hi averyone, I'm using a new function to include two query into an unique transaction. Is this the only way to do it? The following lines show you my function, the purpose is to return the id_utente field (serial) of the last insert done: ---------------------------------------- CREATE FUNCTION "id_from_insert"("varchar", "varchar", "int4", "bpchar", "varchar", "int4", "int4", "int4", "varchar", "int4", "bpchar", "varchar", "varchar") RETURNS "int4" AS 'INSERT INTO g_registrazione_generale ( nome, cognome, data_di_nascita, genere, indirizzo, codice_postale, telefono, id_documentazione, email, data_inserimento, stato, velocita_connessione, istruzione ) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13 ); SELECT max(g_registrazione_generale.id_utente) FROM g_registrazione_generale; ' LANGUAGE 'sql'; ---------------------------------------------------------------------- Best regards