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 1iVrEO-00047F-JS for pgsql-bugs@arkaria.postgresql.org; Sat, 16 Nov 2019 06:06:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iVrDN-00032v-QO for pgsql-bugs@arkaria.postgresql.org; Sat, 16 Nov 2019 06:05:45 +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 1iVrDN-00032o-Hp for pgsql-bugs@lists.postgresql.org; Sat, 16 Nov 2019 06:05:45 +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 1iVrDJ-0001yI-T7 for pgsql-bugs@lists.postgresql.org; Sat, 16 Nov 2019 06:05:44 +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 xAG65aO0006369; Sat, 16 Nov 2019 01:05:36 -0500 From: Tom Lane To: dmitry.telpt@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16119: pg_dump omits columns specification for matviews In-reply-to: <16119-e64823f30a45a754@postgresql.org> References: <16119-e64823f30a45a754@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 15 Nov 2019 22:16:51 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6367.1573884336.1@sss.pgh.pa.us> Date: Sat, 16 Nov 2019 01:05:36 -0500 Message-ID: <6368.1573884336@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > We've faced up with an issue how pg_dump exports materialzed views, it > doesn't export columns declaration that is legal parameter of CREATE DDL > instruction. > As I can see from db_dump source, it's intent behaviour and supposed that > columns declarion will be picked up from query statement when matview is > created by target instance. However, if matview is 'static' (doesn't have a > query statement), it sets default column names (column1, column2, etc) that > breaks all dependent tables/views/matviews, for instance: > postgres=> CREATE MATERIALIZED VIEW test_mv > (id, alias) AS > VALUES (1, 5), (2, 6), (3, 17) > ; Hmm ... I agree this is not good, but this example doesn't seem like a matview that anyone would create in practice. For curiosity's sake, would you explain the actual use-case that you hit this in? regards, tom lane