pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ugur Yilmaz <ugurlu2001@hotmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: Ynt: BUG #18793: PLpgSQL Function Returning Type of Table is not match for varchar(n) data type via Return Query
Date: Sun, 09 Feb 2025 18:19:27 -0500
Message-ID: <2069593.1739143167@sss.pgh.pa.us> (raw)
In-Reply-To: <DU0PR10MB7142A855C86EC71EAD9C9F1CC0F32@DU0PR10MB7142.EURPRD10.PROD.OUTLOOK.COM>
References: <18793-07a72289887f0966@postgresql.org>
	<65eb4d7a46a2759dc2583f274bf50d16811caebe.camel@cybertec.at>
	<DU0PR10MB7142A855C86EC71EAD9C9F1CC0F32@DU0PR10MB7142.EURPRD10.PROD.OUTLOOK.COM>

Ugur Yilmaz <ugurlu2001@hotmail.com> writes:
> Thank you for the explanations and information. Although I find your answers convincing; I still can't understand why I can't get the desired result from the Varchar(n) type, whose -max- length I explicitly specified in the "Returns Table" statement.

Yeah.  There is about zero chance that we are going to rework that:
the decision that function argument and result types are identified
by type OID alone is ancient and deeply rooted.  Even ignoring the
costs of changing a lot of code, there are semantic problems.
For example, should we allow both of these functions to exist
concurrently?

	create function f(varchar(100)) returns ...;
	create function f(varchar(200)) returns ...;

If so, which do we pick when we're uncertain about the length
of the argument value?

You could however make a reasonable case that we should not accept
"varchar(200)" in contexts where we're going to ignore the "(200)"
part.  That's pretty ancient too, cf this comment in gram.y:

 * We can catch over-specified arguments here if we want to,
 * but for now better to silently swallow typmod, etc.
 * - thomas 2000-03-22

I'm not sure whether rejecting such things would make more people
happy than it made unhappy.

In any case, there's a whole lot of history here and a lot of
reason to worry about backwards compatibility.

			regards, tom lane





view thread (3+ messages)

Message-ID: <2069593.1739143167@sss.pgh.pa.us>
Permalink:  ../2069593.1739143167@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2069593.1739143167@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ugurlu2001@hotmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Ynt: BUG #18793: PLpgSQL Function Returning Type of Table is not match for varchar(n) data type via Return Query
  In-Reply-To: <2069593.1739143167@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox