Re: Re: Querying foreign table with SP-GiST index results in “ERROR: cache lookup failed for type 0”

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paul Ramsey <pramsey(at)cleverelephant(dot)ca>
Cc: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Joao Ferreira <jpgferreira(at)yahoo(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Re: Querying foreign table with SP-GiST index results in “ERROR: cache lookup failed for type 0”
Date: 2019-06-26 23:39:43
Message-ID: 18552.1561592383@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Paul Ramsey <pramsey(at)cleverelephant(dot)ca> writes:
>> On Jun 26, 2019, at 2:06 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> More than a bit :-(. That's guaranteed to fail if type box2df isn't
>> in the search path, which it likely won't be during a remote query,
>> since postgres_fdw locks down the search path to just pg_catalog.

> We had a similar problem, if I recall correctly, doing lookups of spatial reference information, for similar reasons: calling over FDW the search_path was so limited the internal lookup functions couldn’t find the spatial_ref_sys table. I just looked up the work-around, and it looks like we infer that the table we’re looking for (part of PostGIS) resides in the same schema as the calling function (part of PostGIS), and then cache that schema name for future use.

Yeah. The variant I was thinking about was to look up the namespace
of the geometry type (which in this example you could get from attType
of the spgConfigIn parameter struct) and assume that box2df is in that
schema. But working from the function's own schema might be better
because you could do the same thing in all these places, rather than
needing to find an associated object in some call-site-specific way.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-06-27 02:46:54 BUG #15877: Cannot CREATE EXTENSION for postgis 2.4 because of missing gdal23-libs ldconfig path
Previous Message Paul Ramsey 2019-06-26 21:31:40 Re: Querying foreign table with SP-GiST index results in “ERROR: cache lookup failed for type 0”