Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngTQv-0002wd-UX for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Apr 2022 15:36:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ngTQu-0004db-Gs for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Apr 2022 15:36:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngTQu-0004dS-7l for pgsql-bugs@lists.postgresql.org; Mon, 18 Apr 2022 15:36:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngTQs-0003wt-9O for pgsql-bugs@lists.postgresql.org; Mon, 18 Apr 2022 15:36:55 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 23IFapuf2283492; Mon, 18 Apr 2022 11:36:52 -0400 From: Tom Lane To: r.zharkov@postgrespro.ru cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17465: Wrong error message while trying to change system column type. In-reply-to: <17465-f2a554a6cb5740d3@postgresql.org> References: <17465-f2a554a6cb5740d3@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Mon, 18 Apr 2022 11:13:28 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2283490.1650296211.1@sss.pgh.pa.us> Date: Mon, 18 Apr 2022 11:36:51 -0400 Message-ID: <2283491.1650296211@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > accidentally I tried to change a system column data type on Windows and got > a strange error message "no owned sequence found": > postgres=# alter table t1 alter column cmin type text; > ERROR: no owned sequence found > postgres=# alter table t1 alter column cmax type text; > ERROR: cannot alter system column "cmax" Yeah, same here. > I think the ATParseTransformCmd() function needs the same check as the check > in the ATPrepAlterColumnType() function. That seems pretty duplicative. I think it's sufficient to do something like - if (TupleDescAttr(tupdesc, attnum - 1)->attidentity) + if (attnum > 0 && + TupleDescAttr(tupdesc, attnum - 1)->attidentity) in the faulty code, and let the actual error message come out where it does now. Will fix, thanks for the report! regards, tom lane