"David G. Johnston" <david.g.johns...@gmail.com> writes: > On Wednesday, August 6, 2025, Rumpi Gravenstein <rgrav...@gmail.com> wrote: >> Here's a reproducible test case that causes the problem in different >> schemas. The issue appears to be related to creating a table and a >> function that has the same name as the table with a prepended underscore.
> Don’t do that. Naming a function (action) and table (noun) the same seems > unwise anyway, underscores or no. Yeah. The chain of events here is: * A table has a matching composite type with the same name as the table. * The composite type also has an associated array type, which will normally be named as the composite type's name with a prepended underscore. * For any type name, the syntax "type_name(argument)" is understood as a possible request to cast to that type, the same as "argument::type_name". There are restrictions on whether that interpretation will be applied, but none of them keep you out of trouble in this example. This is all covered in our documentation, though not all in one place. Perhaps we'd think twice about some of these choices if we were redesigning in a green field; but these are things that Postgres has done for decades and we'd surely break applications if we changed them now. regards, tom lane