Ynt: BUG #18793: PLpgSQL Function Returning Type of Table is not match for varchar(n) data type via Return Query

From: Ugur Yilmaz <ugurlu2001(at)hotmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Ynt: BUG #18793: PLpgSQL Function Returning Type of Table is not match for varchar(n) data type via Return Query
Date: 2025-02-09 21:22:24
Message-ID: DU0PR10MB714275ACEBAB82D8C8F559D5C0F32@DU0PR10MB7142.EURPRD10.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Sorry for late reply, I've been out of town for a while and have only just been able to answer my emails.

As I explain, the result set "looks like" working as designed but not like so.

The result set I expect is a fixed length value: (varchar 200)

However, the result set I get is a varchar (indefinite length) value.

In my application development environment, it is important for the length information to be fixed as much as the type of the data type...

In summary: " varchar (indefine) != varchar (200)"
________________________________
Gönderen: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Gönderildi: 4 Şubat 2025 Salı 18:13
Kime: ugurlu2001(at)hotmail(dot)com <ugurlu2001(at)hotmail(dot)com>; pgsql-bugs(at)lists(dot)postgresql(dot)org <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Konu: Re: BUG #18793: PLpgSQL Function Returning Type of Table is not match for varchar(n) data type via Return Query

On Tue, 2025-02-04 at 12:43 +0000, PG Bug reporting form wrote:
> I have a set of "Functions" that I created dynamically with PLPgSQL and are
> connected to each other in a chain.
>
> The first function dynamically creates the second function. The second
> function returns a set of values with a dynamic "Return Query" statement and
> a reference to "Returns Table (field1 type1, field2 type2 .... )".
>
> Basically, the result set seems to return exactly the desired result. The
> exception is the varchar(n) fixed-length data type. Although the result set
> is expected to be varchar(n) -a fixed-length value is expected-, a result of
> type character varying (length indeterminate) is obtained.
>
> [...]
>
> As far as I have determined, the Postgresql database engine somehow returns
> the varchar(n) - Fixed Length - data type as a "character varying" -
> indefinite length data type.
>
> I hope this situation, which I observed as a problem, will be fixed as soon
> as possible.

That is working asdesigned. Why is it a problem for you?

Yours,
Laurenz Albe

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ugur Yilmaz 2025-02-09 22:34:35 Ynt: BUG #18793: PLpgSQL Function Returning Type of Table is not match for varchar(n) data type via Return Query
Previous Message PG Bug reporting form 2025-02-09 17:46:55 BUG #18801: JIT recompiles function for each row if custom aggregation function is used