Re: Failed Assertion about PolymorphicType

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jaime Casanova <jaime.casanova@2ndquadrant.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2020-04-04T21:21:07Z
Lists: pgsql-hackers
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



Commits

  1. Remove bogus Assert, add some regression test cases showing why.