Re: Oid registry - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Oid registry
Date
Msg-id 21500.1348589669@sss.pgh.pa.us
Whole thread Raw
In response to Re: Oid registry  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Oid registry
List pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Excerpts from Hitoshi Harada's message of mar sep 25 02:11:14 -0300 2012:
>> Of course you can
>> look up type name conlusting SysCache and see if the type name is
>> "hstore", but it's expensive to do it for every function invocation,
>> so caching the hstore's oid in plv8 is the current workaround, which
>> is not truly safe because the hstore's oid may change while caching.

> Hm, couldn't you just register an invalidation callback with
> CacheRegisterSyscacheCallback()?

Yeah, if the code that needs the value is in the backend; but if it is,
the cost of looking the value up again probably isn't that much either.
The need for a cache is much greater in client-side code.

The bigger issues in my mind have to do with how you look up the type in
the first place (considering schema search path and so forth) and how
you know that "hstore" is what you think it is.

I recall some discussion of assigning a UUID to each datatype, which
might alleviate the second part of that at least.  Does nothing for
malicious impersonation of a datatype of course, but should prevent
accidental collisions.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Re: [WIP] Performance Improvement by reducing WAL for Update Operation
Next
From: Fujii Masao
Date:
Subject: Re: xlog filename formatting functions in recovery