Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZd5Z-0004Wy-Sy for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Nov 2019 15:49:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iZd5Y-0005CQ-1q for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Nov 2019 15:49:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZd5X-0005CJ-P3 for pgsql-hackers@lists.postgresql.org; Tue, 26 Nov 2019 15:49:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZd5V-0008Fv-I4 for pgsql-hackers@lists.postgresql.org; Tue, 26 Nov 2019 15:49:15 +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 xAQFnBxv006353; Tue, 26 Nov 2019 10:49:11 -0500 From: Tom Lane To: Andreas Joseph Krogh cc: pgsql-hackers@lists.postgresql.org Subject: Re: ERROR: attribute number 6 exceeds number of columns 5 In-reply-to: References: Comments: In-reply-to Andreas Joseph Krogh message dated "Tue, 26 Nov 2019 15:04:51 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6351.1574783351.1@sss.pgh.pa.us> Date: Tue, 26 Nov 2019 10:49:11 -0500 Message-ID: <6352.1574783351@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andreas Joseph Krogh writes: > Run the attached script and you'll get: > psql -f error.sql -d test > psql:error.sql:37: ERROR: attribute number 6 exceeds number of columns 5 Hmm, interesting. IMO, that *should* have thrown an error, but of course not that one. The ADD COLUMN operations are all processed in parallel, so it's not okay for one of them to have a GENERATED expression that refers to another one of the new columns. But you should have gotten a "no such column" type of error, not a run-time cross-check failure. regards, tom lane