Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vc9ua-000136-1P for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Nov 2013 08:16:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vc9uZ-0004nq-6l for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Nov 2013 08:16:55 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vc9uX-0004nf-1J for pgsql-hackers@postgresql.org; Fri, 01 Nov 2013 08:16:53 +0000 Received: from nm19-vm0.bullet.mail.bf1.yahoo.com ([98.139.213.162]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vc9uT-0005i0-48 for pgsql-hackers@postgresql.org; Fri, 01 Nov 2013 08:16:51 +0000 Received: from [98.139.212.152] by nm19.bullet.mail.bf1.yahoo.com with NNFMP; 01 Nov 2013 08:16:47 -0000 Received: from [98.139.212.210] by tm9.bullet.mail.bf1.yahoo.com with NNFMP; 01 Nov 2013 08:16:47 -0000 Received: from [127.0.0.1] by omp1019.mail.bf1.yahoo.com with NNFMP; 01 Nov 2013 08:16:47 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 697683.22845.bm@omp1019.mail.bf1.yahoo.com Received: (qmail 9307 invoked by uid 60001); 1 Nov 2013 08:16:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s1024; t=1383293807; bh=WpUSoTp1nx0bzt4iNbDTcwNjtT6YFKc8xBH0gLSSIOc=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=w411C/IXDMkE9arSh9VpeSEwLzItbgP+MiSw3x87qEEFH1zMsPJcDPH5h/1nCLB9Ac2CCq+kE25FYfRb0ozMsrSLJ4s8kbP8/w81Igvwo194sUlzODKKNUbil79L4VB7ItRYUxoaTOIbf2PPuSEXGD9uVs8BzQaMzFCmGnUBe+o= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=ymail.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=bxDpWstRTRhVLFPKwup0U9djHSL/tspcSnKiMq6PL1HmDXYK7fAcxp8I7//C1bBhgN5/M+GpytXKhyRB/X7XS7+aus6XsBYMlIltapMI8Kj1qRM2GtzY+zBB8aUZ2UgIAUhT8ysJ8g1ykmhzGUWetuDGhYxN7Fv9myIKc33a8O0=; X-YMail-OSG: 4RIUsF8VM1lOWmpeoOnK7HXOkeiPDb86MMKZOzqJ4rBpjZV TKAfycJbEXhm1eTwW0zu43rsCxA6bhKprsIOcVF0._ODTI5rL44R8ps9j7yc 0xzTVx8bmeiLbl2.6OQ64xcLJyZhrLFze8gSBfu6.6WLiZ.rqnEWKx233sXe bDV9yTPhhnRzM366XwMISH4fVj5HVz2cP.MNoRxeHnREvNRPivRSCkXrA_dw 5hwyGdDfoo9cfZcw2IsWm0TthaaR8DKESseDsNRzEdeVwDq8CFg3yAnySs8x W9gx7Wy2B8oqjT5ZKbfBHr48npRwbZiWHjG6W9hd9tE.SyAm0N0xaqis.7Cf _VSFeY2PvWI_uP0TrkVuyHkH1D_cbMpXC5MqmefyBFIMYsMNVhZB5.rC.gzq rplQCW0FjIvLEqJjISMOP4rYD06bydSiOOzkBTwXaBKuN4KTpLoRI6cWDoB_ MKHTH8P7B9a1JkgTKlniwWvlz6sHvUr8XpjcQ2rQ9UkXyNUCO5WBdvz7k7h5 gcxbjfuNG0iU82WzJnWG89esB8sgI31kmhtFKgJ1AzAAMsHv4VcneUWkrhoU wDEhBEQAan6EbnidC2CygV4k65g39LYXyhG1cvMXBpz_DrYi6RJNbWGn41F3 J1.g- Received: from [76.255.18.237] by web162904.mail.bf1.yahoo.com via HTTP; Fri, 01 Nov 2013 01:16:47 PDT X-Rocket-MIMEInfo: 002.001, TWljaGFlbCBQYXF1aWVyIDxtaWNoYWVsLnBhcXVpZXJAZ21haWwuY29tPiB3cm90ZToKCj4gSSBhbSBub3Qgc3VyZSB0aGF0IGFkZGluZyBhIGJvb2xlYW4gZmxhZyBpbnRyb2R1Y2luZyBhIGNvbmNlcHQKPiByZWxhdGVkIHRvIG1hdHZpZXcgaW5zaWRlIGNoZWNrUnVsZVJlc3VsdExpc3QgaXMgdGhlIGJlc3QKPiBhcHByb2FjaCB0byBzb2x2ZSB0aGF0LiBjaGVja1J1bGVSZXN1bHRMaXN0IGlzIHNvbWV0aGluZyByZWxhdGVkCj4gb25seSB0byBydWxlcywgYW5kIGhhcyBub3RoaW5nIHJlbGF0ZWQgdG8gbWEBMAEBAQE- X-Mailer: YahooMailWebService/0.8.161.596 References: <1383258177.17099.YahooMailNeo@web162903.mail.bf1.yahoo.com> Message-ID: <1383293807.9149.YahooMailNeo@web162904.mail.bf1.yahoo.com> Date: Fri, 1 Nov 2013 01:16:47 -0700 (PDT) From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: [BUGS] BUG #8542: Materialized View with another column_name does not work? To: Michael Paquier Cc: "t.katsumata1122@gmail.com" , "pgsql-hackers@postgresql.org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: 0.7 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Michael Paquier wrote: > I am not sure that adding a boolean flag introducing a concept > related to matview inside checkRuleResultList is the best > approach to solve that. checkRuleResultList is something related > only to rules, and has nothing related to matviews in it yet. Well, I was tempted to keep that concept in DefineQueryRewrite() where the call is made, by calling=A0 the new bool something like requireColumnNameMatch and not having checkRuleResultList() continue to use isSelect for that purpose at all.=20 DefineQueryRewrite() already references RELKIND_RELATION once, RELKIND_MATVIEW twice, and RELKIND_VIEW three times, so it would hardly be introducing a new concept there.=A0 I did it the way I did in the posted patch because it seemed to more nearly match what Tom was suggesting. > I have been pondering myself about this issue, and wouldn't it be > better to directly enforce targetList in checkRuleResultList call > at an upper level with the column name list given by users if > there is any instead of the list of columns of the SELECT query? > > After looking closely at the code this looks to be a better > approach from a general viewpoint. I didn't got the time to write > a patch but this is the conclusion I reached after some analysis > at least... That doesn't sound like something we could back-patch. Anyway, I'm not sure why that would be better.=A0 We have rewrite rules on three kinds of relations -- tables, views, and materialized views.=A0 In general, a materialized view tends to support the properties of both a view and a table, with a few points in the rewrite code that need to pay attention to which kind of relation the rule applies to.=A0 Among the various validations for the rewrite, this one validation (matching column names) does not apply to a non-SELECT rule with a RETURNING clause or to a SELECT rule which populates a materialized view.=A0 If you were to move the code to exclude this validation for the latter case, wouldn't you also need to move the validation for the former case?=A0 Where would you put that? --=20 Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers