Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 698479FCB9D for ; Thu, 8 Nov 2007 14:03:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 70856-02-8 for ; Thu, 8 Nov 2007 14:03:03 -0400 (AST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by postgresql.org (Postfix) with ESMTP id 9B5759FCB8F for ; Thu, 8 Nov 2007 14:03:02 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id j3so409406ugf for ; Thu, 08 Nov 2007 10:03:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=wWVHMMN8D4BwnZExrtB+DxEw1O8VPsFDDAOB7m69mng=; b=RHznZb/6Mc8FY8AeqaDIjWhekAv2dLAI+w6IPJ9ARmKCeFF3GC4VXVbaUW9mZsxpXswNSB9lE+/kqzOJ/NdLTwOAQKAIH7doAKW6jRHIdaS8naCwS99Tvl9eLjaUDN4O6BfQSBW5fJWXUQgG8wvb/pmhxBJ7gYdwJ5ZlzJqQ7LA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=p0Elso38PJ57OobsDdUACGxSr1spJBrV2f3lKJCC+iTpyz3mjWLoPqfewzcD1xOvkx7mU0p7YYl1U9WMEu/3TX0QKPlT4fRIixQAP8AlfCkSjZ4RxFkPURbRQwDimGt7RE84xdZ9J9thT7io5JQdZ6XuI62G6eE5NzEJvN2IOBs= Received: by 10.67.122.10 with SMTP id z10mr27501ugm.1194544980632; Thu, 08 Nov 2007 10:03:00 -0800 (PST) Received: by 10.67.16.19 with HTTP; Thu, 8 Nov 2007 10:03:00 -0800 (PST) Message-ID: Date: Thu, 8 Nov 2007 12:03:00 -0600 From: "Scott Marlowe" To: "Oliveiros Cristina" Subject: Re: Obtaining the primary key of the record just inserted Cc: pgsql-sql@postgresql.org In-Reply-To: <009901c82230$a799d3b0$ec5a3d0a@marktestcr.marktest.pt> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <009901c82230$a799d3b0$ec5a3d0a@marktestcr.marktest.pt> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/28 X-Sequence-Number: 29556 On Nov 8, 2007 11:56 AM, Oliveiros Cristina wrote: > > Hello, All, > > I have the need to know the primary key assigned to a record I've just > INSERTed . > > Is there an easy way to solve this ? > > Similar to SQLServer's SELECT scope_identity() ; ? In 8.2 and up: insert into table a (info) values ('abc') returning id;