From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | "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> |
Subject: | Re: BUG #18793: PLpgSQL Function Returning Type of Table is not match for varchar(n) data type via Return Query |
Date: | 2025-02-04 15:30:03 |
Message-ID: | CAKFQuwa-R9UdDfbqfYyMBuYLT6dqFRcJAMB26jBgBkgDvBFJtw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tuesday, February 4, 2025, PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:
. The
>
> exception is the varchar(n) fixed-length data type
>
That isn’t how this works. The (n) does not make it “fixed-width’. It
simply is a way to enforce a maximum length to the value but otherwise the
data type itself is still variable width. Mostly we recommend use of text,
dealing with constraints in other more global ways.
Correctly working SQL script:
I’ll wait for a “minimal reproducer” to dive into specifics if there are
still questions.
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.
Mostly functions drop the (n) specifier and deal with the data type
itself. The function only wants a concrete value and doesn’t deal with
enforcing constraints in its signature. You can add code to the body if
you need that.
>
> I hope this situation, which I observed as a problem, will be fixed as soon
> as possible.
>
If the absence of the typmod as it is called (the (n)) is problem there
isn’t a change forthcoming to rework that part of the system. It’s a
limitation we are living with.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-02-04 15:49:49 | Re: BUG #18793: PLpgSQL Function Returning Type of Table is not match for varchar(n) data type via Return Query |
Previous Message | Laurenz Albe | 2025-02-04 15:13:46 | Re: BUG #18793: PLpgSQL Function Returning Type of Table is not match for varchar(n) data type via Return Query |