Re: Updates of SE-PostgreSQL 8.4devel patches (r1324)

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Gregory Stark <stark(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>, pgsql-hackers(at)postgresql(dot)org, simon(at)2ndQuadrant(dot)com
Subject: Re: Updates of SE-PostgreSQL 8.4devel patches (r1324)
Date: 2008-12-20 00:21:29
Message-ID: 20081220002129.GF4278@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

KaiGai Kohei wrote:

>> Can we support two data types, one for read-only and another for
>> possible creation? That is not going to work for a query like
>>
>> SELECT * FROM x WHERE col != 'valid_but_new_security_label'::regseclabel;
>>
>> because the cast would fail if the pg_security row doesn't exist, but
>> the query itself perhaps might succeed and return rows.
>
> It has a same matter. If user cast a text into the type of possible
> creation, it can cause an unnecessary insertion.

How's this for an idea. Keep a cache in memory, which has a reference
counter. This counter would only be incremented for written tuples. At
transaction end (or when the cache is full and you need more room),
entries are evicted; if the reference count is greater than zero on
eviction, a pg_security entry is created. Otherwise it is just
discarded. pg_security entry creation (i.e. eviction from cache, or at
transaction end) is WAL-logged, which is enough in case of a crash,
because if a tuple is written with an unlogged pg_security OID, the
transaction did not abort and thus nobody can possibly be interested in
translating it.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2008-12-20 00:22:28 Re: Updates of SE-PostgreSQL 8.4devel patches (r1324)
Previous Message KaiGai Kohei 2008-12-19 23:53:23 Re: Updates of SE-PostgreSQL 8.4devel patches (r1324)