Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y1dMk-000826-Ux for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Dec 2014 15:51:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y1dMj-0007KW-31 for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Dec 2014 15:51:49 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y1dMb-0007Be-2c for pgsql-bugs@postgresql.org; Thu, 18 Dec 2014 15:51:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y1dMV-00083x-7w for pgsql-bugs@postgresql.org; Thu, 18 Dec 2014 15:51:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id sBIFpYFn016271; Thu, 18 Dec 2014 10:51:34 -0500 From: Tom Lane To: Jan Hink cc: pgsql-bugs@postgresql.org Subject: Re: Create into temp table as select doesn set "found" In-reply-to: References: Comments: In-reply-to Jan Hink message dated "Thu, 18 Dec 2014 10:30:51 +0100" Date: Thu, 18 Dec 2014 10:51:34 -0500 Message-ID: <16270.1418917894@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Jan Hink writes: > In plpgsql procedure I have this commads: > create temp table t_expert on commit drop as > select * from v_expert e where user_account=$1; > get diagnostics rowcount=row_count; > raise notice 'found=%, rowcount=%', found, rowcount; > The notice returned "found=f, rowcount=2" > I expected "found" should be set properly to true, when rowcount>0. The set of statements that affect FOUND is specified here: http://www.postgresql.org/docs/9.3/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS CREATE TABLE AS is not among them. In a green field we might think that it would be a good idea if it did, but at this point in plpgsql's evolution changing that behavior would be more likely to break existing code than to make users happier. In particular, there is intentionally not a promise that FOUND and ROW_COUNT are set by the exact same collections of statements. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs