From: Tom Lane <tgl@sss.pgh.pa.us>
To: Etsuro Fujita <etsuro.fujita@gmail.com>
Cc: Paul Ramsey <pramsey@cleverelephant.ca>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: Joao Ferreira <jpgferreira@yahoo.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: Re: Querying foreign table with SP-GiST index results in “ERROR: cache lookup failed for type 0”
Date: Wed, 26 Jun 2019 17:06:47 -0400
Message-ID: <12443.1561583207@sss.pgh.pa.us> (raw)
In-Reply-To: <CAPmGK16s=M3P28tP_XRiWT49nYysa72MOx57VWWA_VJekrkCNQ@mail.gmail.com>
References: <1407840601.3022762.1560857315693.ref@mail.yahoo.com>
<1407840601.3022762.1560857315693@mail.yahoo.com>
<CAMkU=1xocCv5rASP6+GAk3KyhQ-CrzoezQ-vb8p6UuHnX6k38Q@mail.gmail.com>
<CAPmGK15z66yN9e=PU4pSpSi6Qs5NG+J4MoEOCLDB79ESadPG0A@mail.gmail.com>
<CAPmGK16s=M3P28tP_XRiWT49nYysa72MOx57VWWA_VJekrkCNQ@mail.gmail.com>
Etsuro Fujita <etsuro.fujita@gmail.com> writes:
> I found that this error is thrown by index_can_return()
> (spgcanreturn()) called from get_relation_info() for the SP-GiST index
> on the locations table.
> PGDLLEXPORT Datum gserialized_spgist_config_2d(PG_FUNCTION_ARGS)
> {
> spgConfigOut *cfg = (spgConfigOut *)PG_GETARG_POINTER(1);
> --> Oid boxoid = TypenameGetTypid("box2df");
> cfg->prefixType = boxoid;
> cfg->labelType = VOIDOID; /* We don't need node labels. */
> cfg->leafType = boxoid;
> cfg->canReturnData = false;
> cfg->longValuesOK = false;
> PG_RETURN_VOID();
> }
> I'm a newbie to PostGIS, so maybe I'm missing something, but isn't it
> a bit fragile to use TypenameGetTypid() here?
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.
This is a Postgis bug. It's probably not quite trivial to solve,
since this code can't know what schema the type is installed in
at runtime. This seems related to the discussions we had awhile
ago about how planner support functions can find out the OIDs of
extension objects reliably. I'm not sure where Paul is on that...
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, etsuro.fujita@gmail.com, pramsey@cleverelephant.ca, jeff.janes@gmail.com, jpgferreira@yahoo.com
Subject: Re: Querying foreign table with SP-GiST index results in “ERROR: cache lookup failed for type 0”
In-Reply-To: <12443.1561583207@sss.pgh.pa.us>
References: <1407840601.3022762.1560857315693.ref@mail.yahoo.com> <1407840601.3022762.1560857315693@mail.yahoo.com> <CAMkU=1xocCv5rASP6+GAk3KyhQ-CrzoezQ-vb8p6UuHnX6k38Q@mail.gmail.com> <CAPmGK15z66yN9e=PU4pSpSi6Qs5NG+J4MoEOCLDB79ESadPG0A@mail.gmail.com> <CAPmGK16s=M3P28tP_XRiWT49nYysa72MOx57VWWA_VJekrkCNQ@mail.gmail.com> <12443.1561583207@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox