Re: BUG: text(varchar) truncates at 31 bytes

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Dave Blasby <dblasby(at)refractions(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG: text(varchar) truncates at 31 bytes
Date: 2001-10-12 17:47:37
Message-ID: 200110121747.f9CHlbi10189@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


I can confirm this is fixed in current sources. Thanks for the report.

---------------------------------------------------------------------------

> #create table t (v varchar);
> #insert into t values ('0123456789a0123456789b0123456789c0123456789d');
>
> #select v from t;
>
> v
> ----------------------------------------------
> 0123456789a0123456789b0123456789c0123456789d
> (1 row)
>
> So far, so good.
>
> #select text(v) from t;
>
> text
> ---------------------------------
> 0123456789a0123456789b012345678
> (1 row)
>
> Truncation occurs.
>
> Work around:
>
> # select v::text from t;
> ?column?
> ----------------------------------------------
> 0123456789a0123456789b0123456789c0123456789d
> (1 row)
>
> I couldnt figure out what happens during a text(varchar) call. I looked
> around in pg_proc, but couldnt find the function. There's probably an
> automagic type conversion going on or something.
>
> Could someone explain what all the internal varchar-like types are (ie.
> varchar,varchar(n),text,char,_char,bpchar) and when they're used? I
> find it all really confusing - I'm sure others do too.
>
> 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;
>
> --> {Description of conversion from varchar to whatever the text()
> function actually works on}
>
>
> Thanks,
> dave
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-10-12 17:54:09 Re: PG_DUMP NLS (Russian)
Previous Message Bruce Momjian 2001-10-12 17:46:03 Re: HISTORY