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

From Stephan Szabo
Subject Re: BUG: text(varchar) truncates at 31 bytes
Date
Msg-id Pine.BSF.4.21.0110031152490.51842-100000@megazone23.bigpanda.com
Whole thread Raw
In response to BUG: text(varchar) truncates at 31 bytes  (Dave Blasby <dblasby@refractions.net>)
Responses Re: BUG: text(varchar) truncates at 31 bytes
List pgsql-hackers
> #select text(v) from t;
> 
>              text               
> ---------------------------------
>  0123456789a0123456789b012345678
> (1 row)
> 
> Truncation occurs.

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.

> Work around:
> 
> # select v::text from t;
>                    ?column?                   
> ----------------------------------------------
>  0123456789a0123456789b0123456789c0123456789d
> (1 row)

These types are probably marked as binary compatible, so
nothing major has to happen in the type conversion.  Same
thing happens in CAST(v AS text).

> Is there anyway to determine what postgresql is doing in its automagic
> function calls? I guess I'm asking for an EXPLAIN that describes
> function calls.  For example, 
> EXPLAIN select text(v) from t;
You can use EXPLAIN VERBOSE if you're willing to wade through the output.
:)




pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG: text(varchar) truncates at 31 bytes
Next
From: Martín Marqués
Date:
Subject: Re: Missing inserts