Re: cache lookup error for shell type creation with incompatible output function (DDL deparsing bug)

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: cache lookup error for shell type creation with incompatible output function (DDL deparsing bug)
Date: 2015-04-22 19:29:06
Message-ID: 20150422192906.GF4369@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier wrote:
> Hi all,
>
> I just bumped into the following problem in HEAD (1c41e2a):
> =# create type my_array_float (INPUT = array_in, OUTPUT = array_out,
> ELEMENT = float4, INTERNALLENGTH = 32);
> ERROR: XX000: cache lookup failed for type 0
> LOCATION: format_type_internal, format_type.c:135

Argh.

> The fix consists in being sure that typoid uses the OID of the type
> shell created, aka the OID stored in adress.ObjectID. Attached is a
> patch with a regression test checking for shell creation with
> incompatible input/output functions (failure caused by output function
> here though) able to check this code path.

Thanks, pushed. I changed the line to be just below TypeShellMake,
which seems slightly better aligned to the comment just below, and in
fact it matches what DefineRange already uses. I also modified a couple
of other places involving TypeCreate: one did not have the "typoid =
addr.objectId" assignment at all; while the other did, it actually seems
misplaced because at that spot we expect that typoid is already correct.
So I added an assert to the other place and changed that assignment to
an assert, too.

I scanned the rest of the bogus commit and couldn't find any other place
on which I made the same mistake.

Thanks for reporting,

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2015-04-22 19:31:38 Re: TABLESAMPLE patch
Previous Message Robert Haas 2015-04-22 19:21:06 Re: Streaming replication and WAL archive interactions