public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: David G. Johnston <[email protected]>
Cc: Rumpi Gravenstein <[email protected]>
Cc: Laurenz Albe <[email protected]>
Cc: PostgreSQL <[email protected]>
Subject: Re: PostgreSQL Bug with simple function unexpectedly treating varchar parameter as an array
Date: Wed, 06 Aug 2025 17:46:32 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKFQuwbU+xEmPdPvnvknz==yX5xLG5DuAxJASnPEcb73+WMATg@mail.gmail.com>
References: <CAEpg1wBxp=25isxj6yt2cf97KtvbwxvJfrJ9qYF8UQxGSBJ93Q@mail.gmail.com>
<[email protected]>
<CAEpg1wCDL+iYbG7ByjHcgfvJy7m3m-rDp-xKiYovvxeKTbG7iQ@mail.gmail.com>
<[email protected]>
<CAEpg1wALRocK=uDSNyJqdc=vhNGjYFmT3H_TNzihSOMS88WHfg@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<CAEpg1wBUcKjbM+vqP=JLHQUCOW9ct=aVRo1gBEtAZ5SuMY6cYQ@mail.gmail.com>
<CAKFQuwZJJQz=Ap_S7taL1iJwS6tT0AvrVGThpxWMgQk9ZLSy2w@mail.gmail.com>
<CAEpg1wA=sJ4Cvs3hUN9rfYBwTC74uFWYUzQGfcfZC4u-K1AH7w@mail.gmail.com>
<CAKFQuwbU+xEmPdPvnvknz==yX5xLG5DuAxJASnPEcb73+WMATg@mail.gmail.com>
"David G. Johnston" <[email protected]> writes:
> On Wednesday, August 6, 2025, Rumpi Gravenstein <[email protected]> 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
view thread (7+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: PostgreSQL Bug with simple function unexpectedly treating varchar parameter as an array
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox