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>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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-06 20:43:06
Message-ID: 12ce45df-2617-4106-9cbb-17c4d58b1bf7@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/6/25 1:17 PM, Rumpi Gravenstein wrote:
> Just coming back to this.  Don't know how to interpret this:
>
> xxx_pub_dev_2_db=# select proname, pronamespace, oid from pg_proc where
> proname like '%sa_setup%';
>     proname     | pronamespace |   oid
> ----------------+--------------+---------
> _sa_setup_role |      7038406 | 7869125
> (1 row)
>
> xxx_pub_dev_2_db=# drop FUNCTION if exists _sa_setup_role;
> DROP FUNCTION
> xxx_pub_dev_2_db=# select proname, pronamespace, oid from pg_proc where
> proname like '%sa_setup%';
> proname | pronamespace | oid
> ---------+--------------+-----
> (0 rows)
>
> xxx_pub_dev_2_db=# select _sa_setup_role('af_repo_app');
> ERROR:  malformed array literal: "af_repo_app"
> LINE 1: select _sa_setup_role('af_repo_app');

Do you have a custom type named sa_setup_role?

In psql do:

\dT

or

select * from pg_type where typname = 'sa_setup_role';

>                               ^
> DETAIL:  Array value must start with "{" or dimension information.
> xxx_pub_dev_2_db=#
>
> On Fri, Jul 25, 2025 at 4:52 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us
> <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> wrote:
>
> Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at
> <mailto:laurenz(dot)albe(at)cybertec(dot)at>> writes:
> > On Fri, 2025-07-25 at 14:10 -0400, Tom Lane wrote:
> >> So ... any chance you have a data type named _sa_setup_role?
>
> > ... it could also be a type "sa_setup_role", and "_sa_setup_role"
> > is interpreted as the corresponding array type:
>
> Oh, of course --- that's a good deal more likely than my version.
>
>                         regards, tom lane
>
>
>
> --
> Rumpi Gravenstein

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2025-08-06 20:43:22 PostgreSQL Bug with simple function unexpectedly treating varchar parameter as an array
Previous Message Ron Johnson 2025-08-06 20:25:59 Re: PostgreSQL Bug with simple function unexpectedly treating varchar parameter as an array