Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 58993B5E0A7 for ; Tue, 7 Jun 2011 16:54:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 55425-03 for ; Tue, 7 Jun 2011 19:54:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id DD0E2B5E0BE for ; Tue, 7 Jun 2011 16:54:03 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p57JrxUl019172; Tue, 7 Jun 2011 15:54:00 -0400 (EDT) To: Robert Haas cc: Alvaro Herrera , Euler Taveira de Oliveira , Emanuel , pgsql-bugs Subject: Re: BUG #6041: Unlogged table was created bad in slave node In-reply-to: References: <201105261137.p4QBbTlt077425@wwwmaster.postgresql.org> <4DDE7905.6050406@timbira.com> <1306427067-sup-7622@alvh.no-ip.org> <25332.1306427674@sss.pgh.pa.us> <1307120363-sup-3085@alvh.no-ip.org> <14416.1307461823@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Tue, 07 Jun 2011 15:24:53 -0400" Date: Tue, 07 Jun 2011 15:53:59 -0400 Message-ID: <19171.1307476439@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/75 X-Sequence-Number: 30454 Robert Haas writes: > I found a few other holes in my previous patch as well. I think this > plugs them all, but it's hard to be sure there aren't any other calls > to RelationGetNumberOfBlocks() that could bomb out. [ squint... ] Do we need those additional tests in plancat.c? I haven't paid attention to whether we support unlogged indexes on logged tables, but if we do, protecting the RelationGetNumberOfBlocks() call is the least of your worries. You ought to be fixing things so the planner won't consider the index valid at all (cf. the indisvalid test at line 165). Similarly, the change in estimate_rel_size seems to be at an awfully low level, akin to locking the barn door after the horses are out. What code path are you thinking will reach there on an unlogged table? It might be that it'd be best just to have both the planner and executor throwing errors on unlogged tables, rather than rejiggering pieces of the planner to sort-of not fail on an unlogged table. regards, tom lane