Failed Assertion about PolymorphicType

Started by Jaime Casanovaalmost 6 years ago2 messages
#1Jaime Casanova
jaime.casanova@2ndquadrant.com
1 attachment(s)

Hi,

Running sqlsmith on master i got an assertion failure on parse_coerce.c:2049

This is a minimal query to reproduce in an empty database, i also
attached the stack trace

"""
select
pg_catalog.array_in(
cast(pg_catalog.regoperatorout(
cast(cast(null as regoperator) as regoperator)) as cstring),
cast((select pronamespace from pg_catalog.pg_proc limit 1 offset 1)
as oid),
cast(subq_1.pid as int4)) as c0
from pg_catalog.pg_stat_progress_analyze as subq_1
"""

--
Jaime Casanova www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

gdb.txttext/plain; charset=US-ASCII; name=gdb.txtDownload
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jaime Casanova (#1)
Re: Failed Assertion about PolymorphicType

Jaime Casanova <jaime.casanova@2ndquadrant.com> writes:

Running sqlsmith on master i got an assertion failure on parse_coerce.c:2049

Hmph, or more simply:

regression=# select array_in('{1,2,3}',23,-1);
server closed the connection unexpectedly

which is a case that worked before. The core of the problem is
that array_in() violates the assumption that a polymorphic result
requires a polymorphic argument:

regression=# \df array_in
List of functions
Schema | Name | Result data type | Argument data types | Type
------------+----------+------------------+-----------------------+------
pg_catalog | array_in | anyarray | cstring, oid, integer | func
(1 row)

I see that enforce_generic_type_consistency did not use to assert
that it'd resolved every polymorphic rettype. So I think we should just
remove that assertion (and fix the incorrect comment that led to
adding it).

regards, tom lane