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

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: cache lookup error for shell type creation with incompatible output function (DDL deparsing bug)
Date: 2015-03-30 04:46:24
Message-ID: CAB7nPqRxuH+3g0SD2pOKQgJitjvCDaHQJ3PY0nMLsKuHZex+Kg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

First note that in ~9.4 the error message is correct:
=# create type my_array_float (INPUT = array_in, OUTPUT = array_out,
ELEMENT = float4, INTERNALLENGTH = 32);
ERROR: 42883: function array_out(my_array_float) does not exist
LOCATION: findTypeOutputFunction, typecmds.c:1709

Now, the problem is caused by findTypeOutputFunction() in DefineType()
because process passes InvalidOid as type OID when creating a type
shell, root cause being a2e35b5 because of this:
+ address = TypeShellMake(typeName, typeNamespace, GetUserId());

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.
Regards,
--
Michael

Attachment Content-Type Size
20150330_array_shell_fix_error.patch application/x-patch 2.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-03-30 05:01:25 Re: pgsql: Centralize definition of integer limits.
Previous Message Amit Kapila 2015-03-30 04:03:57 Re: Relation extension scalability