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 1ns3i0-0003Rg-JJ for pgsql-bugs@arkaria.postgresql.org; Fri, 20 May 2022 14:34:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ns3hy-00059I-IL for pgsql-bugs@arkaria.postgresql.org; Fri, 20 May 2022 14:34:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ns3hy-000592-AB for pgsql-bugs@lists.postgresql.org; Fri, 20 May 2022 14:34:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ns3hu-0003Pm-85 for pgsql-bugs@lists.postgresql.org; Fri, 20 May 2022 14:34:25 +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 24KEYKgU334335; Fri, 20 May 2022 10:34:20 -0400 From: Tom Lane To: Daniel Gustafsson cc: n.lutic@loxodata.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17486: [pg_restore] Restoring a view fails if this view contains an attribute without alias name. In-reply-to: <792E8C73-EBE0-41FC-A83F-2F7A7AF4ABBB@yesql.se> References: <17486-1ad6fd786728b8af@postgresql.org> <792E8C73-EBE0-41FC-A83F-2F7A7AF4ABBB@yesql.se> Comments: In-reply-to Daniel Gustafsson message dated "Fri, 20 May 2022 14:51:08 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <334333.1653057260.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 20 May 2022 10:34:20 -0400 Message-ID: <334334.1653057260@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Daniel Gustafsson writes: >> On 19 May 2022, at 14:03, PG Bug reporting form wrote: >> I found something weird. Restoring a view fails if this view contains a= n >> attribute without alias name. > This is not unique to 14, it can be reproduced further down as well. Yeah, it's an ancient behavior; interesting that no one has complained before. This code in ruleutils is assuming that FigureColname will make the same choice at reload as it did before; which is shaky both because we aren't necessarily printing the identical raw text, and because there's no guarantee we won't change those rules in future. Perhaps we should just tweak ruleutils so that the alias is always printed for non-Var columns, even when it's "?column?". That's kind of ugly, but if you wanted non-ugly you should have selected a better column name to start with. regards, tom lane