Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W5nrW-0003nk-RL for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jan 2014 02:48:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W5nrW-0008Ol-2j for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jan 2014 02:48:18 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W5nrV-0008Oc-2a for pgsql-bugs@postgresql.org; Wed, 22 Jan 2014 02:48:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W5nrO-0004qV-5M for pgsql-bugs@postgresql.org; Wed, 22 Jan 2014 02:48:16 +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 s0M2m8Ix025097; Tue, 21 Jan 2014 21:48:08 -0500 From: Tom Lane To: Marko Tiikkaja cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8870: PL/PgSQL, SELECT .. INTO and the number of result columns In-reply-to: <52DF1CA6.8020800@joh.to> References: <20140118232509.26700.59523@wrigleys.postgresql.org> <25794.1390089578@sss.pgh.pa.us> <52DB2139.20604@joh.to> <52DF1CA6.8020800@joh.to> Comments: In-reply-to Marko Tiikkaja message dated "Wed, 22 Jan 2014 02:19:34 +0100" Date: Tue, 21 Jan 2014 21:48:08 -0500 Message-ID: <25096.1390358888@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) 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 Marko Tiikkaja writes: > On 1/19/14, 1:50 AM, I wrote: >> But making this check at run time doesn't seem too hard. How broken >> does the attached look? > A bit broken, now that I look at it in detail. In particular, I could > see someone doing something like: > CREATE TABLE lotsofcolumns(f1 int, f2 int, f3 int, ..); > DECLARE > f1 int; > f2 int; > BEGIN > SELECT * INTO f1, f2 FROM lotsofcolumns; > I can't say I think this is a good idea, but not sure breaking this case > is worth it either. Um, I thought the whole point was to complain about that. If this isn't a mistake, how can you consistently maintain the other one is? > In bug #8893 there was some discussion which I interpreted to mean that > we could improve this a bit by checking the number of returned columns > during compile time if there's no * in the target list. Attached is a > crude patch attempting to do that, which appears to be working. Any > thoughts? Ick. I thought you wanted to do this at first execution, anyway, not in pl_gram.y. 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