Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baOMo-0005Jd-Q4 for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Aug 2016 14:32:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1baOMn-0002uC-I6 for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Aug 2016 14:32:21 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1baOLQ-0001OT-JB for pgsql-hackers@postgresql.org; Thu, 18 Aug 2016 14:30:56 +0000 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1baOLN-00042y-76 for pgsql-hackers@postgresql.org; Thu, 18 Aug 2016 14:30:55 +0000 Received: by mail-wm0-x22a.google.com with SMTP id i5so34946696wmg.0 for ; Thu, 18 Aug 2016 07:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=hu8fIiJrEUi/wnNzHDqun7nVDeP3zYgaFC6dJsNRre8=; b=G9LaaK9kbiDngP9JM5XSpndwrOspdSsw59IBQ395DSCjZNyOa9YB7thWGeEdetiGH1 IldkR8tMRrdcrPfHPhfqpTgmyHHocu+fA8u3JHv643/jdXVM5ZJyxuCRGwbgOIoqZx7X JKMVzR12I2T0r+OmY7VXYH47sGtuICI5m+VAazkYpGDwyJdKblZLpsZXy68kz4keKC53 MOXn2hY/AWH5Lkr9UkAS6Gio9qGcYgmku9W8MVCVsoYV6Fa3nCP8Uz8fIqEBIhejJ8Zr uyr9zWXe1EI2EQeAUrU8bvFE033L8b29wVxLTJZ0iAcvlDLS0T/pZINbCBtsrzgC3SYg deIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=hu8fIiJrEUi/wnNzHDqun7nVDeP3zYgaFC6dJsNRre8=; b=RXBfKLS5txhfxUh25NgM2496ml9wIQeEvIG07LuS/AU2mnKHc31f1l5bCxtRmzd3kh zhWemc4sIc930ri5N9CtfoLRelwwWiLA5hpJS2YxGr0y4WoNpDmb3CkEK99FhmmmQZln WrPnqUj8d4LFat2JGEplTrWKTF1qVTs1y7VXWRsluY7mMMLdEjz4OqRXw7fZgLGs2Rsr 6x+VaRYg40F78nK0xrZhF48QlTTp4X/Cr5YE/VhXkTv8wBKRVKV+eObbmHqx/XDBGPFE wElj1o941LQ2kiGJValXmhMPDl65N2ozeA0hJwWxVFLeU2oR3LdUBIHLlP48h+f4bOqd PMcg== X-Gm-Message-State: AEkoouuDlMJc19n1xw0utEXwVlDOVS5h1pLMUZWaZBYMC8bJ/ANjVJUoWRteoVHKpaNfc/+DdDfA2dfzvb/fvwZvJJ1dpybzy013HieXl2OjtkXZh+7LPvUI4BwCGT3xThHqVJg4b++ACgc9ZrtvnWwIb37VMesGd+gegQkSFy6HT8ECsAiOeRS2uABtJz1T4n7QTlBb3GUL X-Received: by 10.28.107.88 with SMTP id g85mr33240414wmc.49.1471530650138; Thu, 18 Aug 2016 07:30:50 -0700 (PDT) Received: from [10.137.2.17] (ip-89-177-44-58.net.upcbroadband.cz. [89.177.44.58]) by smtp.gmail.com with ESMTPSA id o76sm2929248wmg.16.2016.08.18.07.30.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Aug 2016 07:30:48 -0700 (PDT) Subject: Re: [Patch] Temporary tables that do not bloat pg_catalog (a.k.a fast temp tables) To: pgsql-hackers@postgresql.org References: <20160801124531.66cde374@fujitsu> <26c3bc60-6613-e7ab-517a-53136f01fb6c@2ndquadrant.com> <13191.1470072250@sss.pgh.pa.us> <20160804151451.6fb87507@fujitsu> <14212.1470595566@sss.pgh.pa.us> <20160815005755.gswdyjfob7dzw4yp@alap3.anarazel.de> <20319.1471223097@sss.pgh.pa.us> <20160815010852.5ijua2wm2edzimd4@alap3.anarazel.de> <20160815121216.46bd758d@e733> <20160817125059.0fb42420@e733> From: Tomas Vondra Message-ID: Date: Thu, 18 Aug 2016 16:30:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Thunderbird/46.0a2 MIME-Version: 1.0 In-Reply-To: <20160817125059.0fb42420@e733> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) 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 On 08/17/2016 11:50 AM, Aleksander Alekseev wrote: >> That doesn't really solve the problem, because OTHER backends won't be >> able to see them. So, if I create a fast temporary table in one >> session that depends on a permanent object, some other session can >> drop the permanent object. If there were REAL catalog entries, that >> wouldn't work, because the other session would see the dependency. >> > > This is a good point. However current implementation doesn't allow to > do that. IMHO without handling that, the design is effectively broken and has very little change (or rather none at all) to get committed. I think one way to fix that would be to store the virtual tuples in shared memory (instead of process memory). That will certainly require locking and synchronization, but well - it needs to be shared. > There is a related bug though, a minor one. > > In session 1: > > ``` > CREATE TABLE cities2 (name text, population float, altitude int); > CREATE FAST TEMPORARY TABLE capitals2 (state char(2)) INHERITS (cities2); > ``` > > In session 2: > > ``` > DROP TABLE cities2; > > ERROR: cache lookup failed for relation 16401 > ``` > > Instead of "cache lookup failed" probably a better error message > should be displayed. Something like "cannot drop table cities2 > because other objects depend on it". I will send a corrected patch > shortly. > > Everything else seems to work as expected. > > If you discover any other bugs please let me know! > While a better error message would be nice, this is curing the symptoms and not the cause. I think a proper design needs to prevent the DROP by using dependencies. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers