Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a3XZg-0008OZ-TP for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Nov 2015 23:09:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a3XZg-0000uW-Fy for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Nov 2015 23:09:36 +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_SHA384:256) (Exim 4.84) (envelope-from ) id 1a3XZf-0000tq-Kv for pgsql-bugs@postgresql.org; Mon, 30 Nov 2015 23:09:35 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a3XZY-0005Kx-2i for pgsql-bugs@postgresql.org; Mon, 30 Nov 2015 23:09:35 +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 tAUN9P6v026995; Mon, 30 Nov 2015 18:09:25 -0500 From: Tom Lane To: Keith Fiske cc: "pgsql-bugs@postgresql.org" Subject: Re: schema-only pg_dump inconsistently dumps some view definitions In-reply-to: References: Comments: In-reply-to Keith Fiske message dated "Mon, 30 Nov 2015 16:31:02 -0500" Date: Mon, 30 Nov 2015 18:09:25 -0500 Message-ID: <26994.1448924965@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Keith Fiske writes: > Ran into a weird issue with pg_dump outputting an odd definition for a > view. First, the view definition > https://gist.github.com/keithf4/24298f7327b4a27054fd > If a pg_dump -s or pg_dumpall -s for the entire database is used, it > outputs the view definition as a table with an ALTER TABLE statement > related to logical replication followed by the "_RETURN" rule later on in > the dump file. pg_dump does that when it's trying to break a circular dependency; that is, there is something referenced in the view definition that cannot be defined before the view exists. The typical thing I've seen is a view defined in terms of a function that takes or returns the view's named rowtype. It's not real clear why it's doing it here, though if you can submit a self-contained test case we could take a look. I suspect though that the answer will be "not a bug". There's been some speculation about revising pg_dump so that what it puts out in such cases involves a dummy view definition followed later by CREATE OR REPLACE VIEW. No one's gotten around to writing a patch for that though, and I rather imagine that it would break unsuspecting tools anyway :-( regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs