Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvsZH-0006Ht-UQ for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Sep 2017 22:06:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dvsZH-0007rR-ES for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Sep 2017 22:06:35 +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 1dvsZF-0007rB-He; Sat, 23 Sep 2017 22:06:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dvsZ8-0001Ne-Nw; Sat, 23 Sep 2017 22:06:32 +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 v8NM6LOs025663; Sat, 23 Sep 2017 18:06:21 -0400 From: Tom Lane To: Andrew Dunstan cc: balazs@obiserver.hu, pgsql-bugs@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [BUGS] BUG #14825: enum type: unsafe use? In-reply-to: <4942e2c0-3302-f496-d4c1-a967f77d0143@2ndQuadrant.com> References: <20170922185904.1448.16585@wrigleys.postgresql.org> <15165.1506116768@sss.pgh.pa.us> <3cece400-af56-7145-2e65-f044de1b0b68@2ndQuadrant.com> <28968.1506136792@sss.pgh.pa.us> <24380.1506179805@sss.pgh.pa.us> <16272.1506189656@sss.pgh.pa.us> <928f5974-151f-0273-0221-fac213e7624f@2ndQuadrant.com> <19137.1506196325@sss.pgh.pa.us> <4942e2c0-3302-f496-d4c1-a967f77d0143@2ndQuadrant.com> Comments: In-reply-to Andrew Dunstan message dated "Sat, 23 Sep 2017 17:45:46 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <25661.1506204381.1@sss.pgh.pa.us> Date: Sat, 23 Sep 2017 18:06:21 -0400 Message-ID: <25662.1506204381@sss.pgh.pa.us> 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 Andrew Dunstan writes: > OK, I think I'm convinced. Here's is the WIP code I put together for the > blacklist. I'm was looking for a place to put the init call, but since > it's possibly not going anywhere I stopped :-) . My initial thought > about substransactions was that we should ignore them for this purpose > (That's why I used TopTransactionContext for the table). For the blacklist, I agree we could just ignore subtransactions: all subtransaction levels are equally uncommitted for this purpose, and leaving entries from failed subtransactions in place seems like a non-issue, since they'd never be referenced again. (Well, barring OID wraparound and an enum-value-OID collision while the transaction runs, but I think we can ignore that as having probability epsilon.) But you need to actually put the table in TopTransactionContext, not CurTransactionContext ;-). Also, I don't think you need an init call so much as an end-of-transaction cleanup call. Maybe call it AtEOXactEnum(), for consistency with other functions called in the same area. > w.r.t. table size - how large? I confess I haven't seen any systems with > more than a few hundred enum types. But even a million or two shouldn't > consume a huge amount of memory, should it? Dynahash tables are self-expanding, so I don't see a need to stress about that too much. Anything in 10-100 seems reasonable for initial size. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers