Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f5MCeWa50104 for ; Fri, 22 Jun 2001 08:40:32 -0400 (EDT) (envelope-from pgsql-admin-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5M01fa30714 for ; Thu, 21 Jun 2001 20:01:41 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f5LNdJN25665 for pgsql-admin@postgresql.org; Thu, 21 Jun 2001 19:39:19 -0400 (EDT) (envelope-from news) From: Gerard Mason X-Newsgroups: comp.databases.postgresql.admin Subject: Re: pg_dump dumps views as tables??? Date: Fri, 22 Jun 2001 00:43:21 +0100 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 78 Message-ID: <3B328699.4080205@hotmail.com> References: <20010620162958.C3249@rice.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: scrappy@hub.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.1) Gecko/20010607 X-Accept-Language: en-us To: pgsql-admin@postgresql.org X-Archive-Number: 200106/157 X-Sequence-Number: 1724 Thank you both *very* much! Ross J. Reedstrom wrote: > If you look farther down that same dump, you'll see a CREATE RULE > that looks something like: > > CREATE RULE AS ON SELECT > > > CREATE RULE "_RETincluded_works" AS ON SELECT TO "included_works" DO > INSTEAD SELECT "works"."uuid", "works"."title" as "lhs" [...] > > In other words, pg_dump, especially before 7.1, exposes the details of > how views are implemented, rather than recreating the SQL you wrote to > create the schema. > > Ross > > > On Tue, Jun 19, 2001 at 09:12:32AM +0100, Gerard Mason wrote: > >>Anybody? >> >> >>"Gerard Mason" wrote in message >>news:9gbd3s$2d6$1@news.tht.net... >> >>>I am running postgresql-server-7.0.3-12mdk (Mandrake 8.0). The relevant >>> >>part >> >>>of my build script looks like this: >>> >>>create view included_works >>>as >>> select uuid, title as lhs >>> , trim(to_char(cast(year_of_publication as int), '0000')) as rhs >>> from works >>> where include=true >>>; >>> >>>What pg_dump actually outputs is this: >>> >>>CREATE TABLE "included_works" ( >>> "uuid" character(36), >>> "lhs" character varying(80), >>> "rhs" text >>>); >>> >>> >>>I would be more appalled if I was less gobsmacked. Surely I'm doing >>>something wrong? But I can't find any reference to this in either the >>> >>Admin >> >>>Guide or the Reference Manual (though admittedly I'm looking at the 7.1 >>>ones -- the 7.0 ones didn't have any info on it at all, I think). >>> >>>Help. >>> >>> >>> >>> >> >> >>---------------------------(end of broadcast)--------------------------- >>TIP 5: Have you checked our extensive FAQ? >> >>http://www.postgresql.org/users-lounge/docs/faq.html >> > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >