Re: BUG: text(varchar) truncates at 31 bytes - Mailing list pgsql-hackers

From Tom Lane
Subject Re: BUG: text(varchar) truncates at 31 bytes
Date
Msg-id 14613.1002147000@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG: text(varchar) truncates at 31 bytes  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-hackers
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> Looking at the explain verbose output, it looks like it may be doing a
> conversion to name because it looks like there isn't a text(varchar),
> but there's a text(name) and a name(varchar).  My guess is there's no
> text(varchar) because they're considered binary compatible.

Since the truncation is to 31 characters, it seems clear that a
conversion to "name" happened.

I think the reason for this behavior is that the possibility of a
"freebie" binary-compatible conversion is not considered until all else
fails (see parse_func.c: it's only considered after func_get_detail
fails).  Unfortunately func_get_detail is willing to consider all sorts
of implicit conversions, so these secondary possibilities end up being
the chosen alternative.

Perhaps it'd be a better idea for the option of a freebie conversion
to be checked earlier, say immediately after we discover there is no
exact match for the function name and input type.  Thomas, what do you
think?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: CEST timezone
Next
From: Bruce Momjian
Date:
Subject: Re: Unicode combining characters