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

From Ugur Yilmaz
Subject Ynt: BUG #18793: PLpgSQL Function Returning Type of Table is not match for varchar(n) data type via Return Query
Date
Msg-id DU0PR10MB714275ACEBAB82D8C8F559D5C0F32@DU0PR10MB7142.EURPRD10.PROD.OUTLOOK.COM
Whole thread Raw
In response to Re: BUG #18793: PLpgSQL Function Returning Type of Table is not match for varchar(n) data type via Return Query  (Laurenz Albe <laurenz.albe@cybertec.at>)
List 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.albe@cybertec.at>
Gönderildi: 4 Şubat 2025 Salı 18:13
Kime: ugurlu2001@hotmail.com <ugurlu2001@hotmail.com>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.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

pgsql-bugs by date:

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