Received: from spamburger.openface.ca (spamburger.openface.ca [216.46.1.2]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f18MT2x06425 for ; Thu, 8 Feb 2001 17:29:02 -0500 (EST) (envelope-from jelle@openface.ca) Received: from what.openface.ca (ozzel.openface.ca [216.46.1.89]) by spamburger.openface.ca (8.8.8/8.8.8) with ESMTP id RAA00727 for ; Thu, 8 Feb 2001 17:29:00 -0500 (EST) Received: from localhost (localhost [[UNIX: localhost]]) by what.openface.ca (8.11.2/8.11.2) with ESMTP id f18MT0U09225 for ; Thu, 8 Feb 2001 17:29:00 -0500 (EST) Date: Thu, 8 Feb 2001 17:28:59 -0500 (EST) From: Jelle Ouwerkerk To: pgsql-sql@postgresql.org Subject: fetching the id of a new row Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200102/168 X-Sequence-Number: 1354 Hi, How might I insert a new row into a table and return the id of the new row all in the same SQL statement? The id is generated by a sequence. Up to now I've been getting the nextval of the sequence first and then inserting with the id in a second SQL exec. Is there a faster way (in a general case, without writing SQL or plpgsql functions)? Thanks