Re: cache lookup error for shell type creation with incompatible output function (DDL deparsing bug) - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: cache lookup error for shell type creation with incompatible output function (DDL deparsing bug)
Date
Msg-id 20150422192906.GF4369@alvh.no-ip.org
Whole thread Raw
In response to cache lookup error for shell type creation with incompatible output function (DDL deparsing bug)  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: cache lookup error for shell type creation with incompatible output function (DDL deparsing bug)
List 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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Streaming replication and WAL archive interactions
Next
From: Petr Jelinek
Date:
Subject: Re: TABLESAMPLE patch