Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W5uY9-0005FL-Vb for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jan 2014 09:56:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W5uY9-000082-Eq for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jan 2014 09:56:45 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W5uY8-000078-9d for pgsql-bugs@postgresql.org; Wed, 22 Jan 2014 09:56:44 +0000 Received: from mail-lb0-f181.google.com ([209.85.217.181]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W5uY4-0004Rb-To for pgsql-bugs@postgresql.org; Wed, 22 Jan 2014 09:56:43 +0000 Received: by mail-lb0-f181.google.com with SMTP id z5so120759lbh.26 for ; Wed, 22 Jan 2014 01:56:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=/eYyWKRJa0ZUkc6jPuNkQLccvwXphgiL8E7VA30tDcI=; b=fIuDVlV2dm/FBur7Loz8kWBrVdzIhf8T1z6MQ3k9QT4s9jdrHtqBQ6yljhYb3qMb74 i9IOg6xwe/aKBRs8WgAt/Jmb8XcM0qRI/UlmR4ZRJesVkXQ2SOYt744GUdXQlyO7lOwZ ohmZvKUnqa4N/dn89/5t3f/uOass0SIxEK07wjTVAF3gCrba38R0hd1/fanZQJUNFfYa 0UtYSCzW8IdOWguk6l4KURQSf1RIxXNJS3q/YfX4hBWkZU8T3cqDX5U7GslrgySg4b+8 Fp/3Mu37oOOHGAA6iT3PIoKUMXxaAGBuNXU4r/b5tPndXrlKH07P9v+tcn85qKPLmjSU 7Uog== X-Gm-Message-State: ALoCoQkolPLlQ5lcFiCI8zHHHIIt2L0bzn6SOlfGMAauNI+g06ow15lj626fFWP3UbkPHXFSox+4 X-Received: by 10.112.14.1 with SMTP id l1mr347088lbc.39.1390384599079; Wed, 22 Jan 2014 01:56:39 -0800 (PST) Received: from dalli.local (c-cba4e355.026-50-73746f15.cust.bredbandsbolaget.se. [85.227.164.203]) by mx.google.com with ESMTPSA id s9sm9546535laj.0.2014.01.22.01.56.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 01:56:37 -0800 (PST) Message-ID: <52DF95D6.50105@joh.to> Date: Wed, 22 Jan 2014 10:56:38 +0100 From: Marko Tiikkaja User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Tom Lane CC: pgsql-bugs@postgresql.org Subject: Re: BUG #8870: PL/PgSQL, SELECT .. INTO and the number of result columns References: <20140118232509.26700.59523@wrigleys.postgresql.org> <25794.1390089578@sss.pgh.pa.us> <52DB2139.20604@joh.to> <52DF1CA6.8020800@joh.to> <25096.1390358888@sss.pgh.pa.us> In-Reply-To: <25096.1390358888@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) 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 On 1/22/14, 3:48 AM, Tom Lane wrote: > Marko Tiikkaja writes: >> 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? I'm sure you can see a difference between explicitly listing the wrong number of columns and using * to ignore trailing columns. That said, this *should* be an error according to the documentation, so it's probably not the end of the world if we break it. >> 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. Catching these errors at compile time would be ideal. If we also want to catch the * cases we could also check the result structure before the first execution. Regards, Marko Tiikkaja -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs