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 1oTksL-0003ii-Q7 for pgsql-general@arkaria.postgresql.org; Thu, 01 Sep 2022 14:08: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 1oTksJ-0005S5-Fi for pgsql-general@arkaria.postgresql.org; Thu, 01 Sep 2022 14:08:55 +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 1oTksJ-0005Rw-54 for pgsql-general@lists.postgresql.org; Thu, 01 Sep 2022 14:08:55 +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 1oTksD-0000T8-RI for pgsql-general@lists.postgresql.org; Thu, 01 Sep 2022 14:08:51 +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 281E8lR9402823; Thu, 1 Sep 2022 10:08:48 -0400 From: Tom Lane To: Wesley Schwengle cc: pgsql-general@lists.postgresql.org Subject: Re: View definition changes after reloading pg_dump export In-reply-to: <58cef826-706a-3838-3ce3-e6011c2ccd76@exxellence.nl> References: <58cef826-706a-3838-3ce3-e6011c2ccd76@exxellence.nl> Comments: In-reply-to Wesley Schwengle message dated "Wed, 31 Aug 2022 14:53:30 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <402821.1662041327.1@sss.pgh.pa.us> Date: Thu, 01 Sep 2022 10:08:47 -0400 Message-ID: <402822.1662041327@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Wesley Schwengle writes: > There is a view that we create and it uses a function and the view > definition changes between runs. I'm not sure why this is happening, > does someone know? The core reason for the discrepancy is that the parser inserts implicit coercion steps into your initial, not-very-consistently-typed query; but the view-dumping logic (ruleutils.c) tends to display those steps as explicit coercions. Formally speaking it shouldn't do that, because the parser may act differently depending on whether a cast is explicitly present, as indeed you see here. But if we don't write the coercions explicitly then there is a risk of the reloaded view being interpreted differently than it was before (perhaps because there are more or different overloaded functions/operators available at reload time). So the dumping logic is kind of between a rock and a hard place. Our experience has been that printing the coercions explicitly causes fewer problems than not doing so, so that's what it does. regards, tom lane