Re: PostgreSQL Bug with simple function unexpectedly treating varchar parameter as an array

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Rumpi Gravenstein <rgravens(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, PostgreSQL <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: PostgreSQL Bug with simple function unexpectedly treating varchar parameter as an array
Date: 2025-08-07 01:15:36
Message-ID: 5f2ce075-25f2-460e-8efc-0eec89afffca@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/6/25 14:39, Rumpi Gravenstein wrote:
> That having a table and function with similar names causes this problem
> is a bug.

Actually it is that a type and function have the same name. The
connection is the table as that where the type gets it's name. Further
complicated by you doing _type_name which turns the type into an array
type.

Now that you know, as the old joke goes:

Doctor: What is the problem?
Patient: It hurts when I do this.
Doctor: Then don't do that.

:)

>
> Going forward I'll be sure to avoid the problem.
>
> On Wed, Aug 6, 2025 at 5:35 PM David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com <mailto:david(dot)g(dot)johnston(at)gmail(dot)com>> wrote:
>
> On Wednesday, August 6, 2025, Rumpi Gravenstein <rgravens(at)gmail(dot)com
> <mailto:rgravens(at)gmail(dot)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.
>
> David J.
>
>
>
> --
> Rumpi Gravenstein

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Siraj G 2025-08-07 01:29:46 Approach for DB migration
Previous Message David G. Johnston 2025-08-07 00:18:47 Re: PostgreSQL Bug with simple function unexpectedly treating varchar parameter as an array