Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YEkT4-000596-BQ for pgsql-sql@arkaria.postgresql.org; Fri, 23 Jan 2015 20:04:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YEkT3-0006ci-8S for pgsql-sql@arkaria.postgresql.org; Fri, 23 Jan 2015 20:04:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YEkSx-0006TM-M0 for pgsql-sql@postgresql.org; Fri, 23 Jan 2015 20:04:27 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YEkSr-0004zA-7v for pgsql-sql@postgresql.org; Fri, 23 Jan 2015 20:04:24 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 12A6C20C04 for ; Fri, 23 Jan 2015 15:04:18 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Fri, 23 Jan 2015 15:04:19 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= x-sasl-enc:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; s=mesmtp; bh=tDpypDcDBiP4Bw3uqdKtAwr7JKY=; b=OYpEIzvJc5p4lU0CeZ 28L4r1bLuZE/ZGEPUw6gJoreO480gUnenrJaBR7y6nqdeMA6t+h0NzRHowKjy8UW VIKmPPE7R8yOyqfkr9MwWm5eeoQ7HkPb8Wa43x/+Rn/hrDn/zTCtAVcaJhsHcXUd rmaLItixoc41gg0rBPWvV2fmM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:message-id:date:from :mime-version:to:subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=tDpypDcDBiP4Bw3uqdKtAw r7JKY=; b=S6u7LxBhkT2uOsAPTL85ChstQW7gtQcHhAnzRbs5OZXyXioqZQ29Hg zuIl6QCuSG+MnmVjOizM0xVRKCJYs1qV5CTAN83OQSkVZIPT/ZfFZrgKiRHLPIqw PWPXY90IBiU2tU6ryqTh+L+DXh/1DrYzCnK471ADUunuHcbuLhQlE= X-Sasl-enc: xdB61+8jYvLCe7Z6QU5V0Sa7JKWwAMiYcgUPK2CA5Anr 1422043458 Received: from [192.168.1.4] (unknown [174.21.201.231]) by mail.messagingengine.com (Postfix) with ESMTPA id 39F23C0001A; Fri, 23 Jan 2015 15:04:18 -0500 (EST) Message-ID: <54C2A941.1000207@aklaver.com> Date: Fri, 23 Jan 2015 12:04:17 -0800 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Suresh Raja , pgsql-general@postgresql.org, pgsql-sql@postgresql.org Subject: Re: commit inside a function failing References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 01/23/2015 11:56 AM, Suresh Raja wrote: > Hi All: > > We are running a function with a loop in it. We tried > commit; > We are getting error with above command. How can i easily commit > withing a function. Functions do not have transactions inside them. If you are using plpgsql you can use EXCEPTIONS: http://www.postgresql.org/docs/9.3/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING > > > Thanks, > -SR -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql