Re: [GENERAL] view columm size..... - Mailing list pgsql-general

From Ross J. Reedstrom
Subject Re: [GENERAL] view columm size.....
Date
Msg-id 20000210113510.A8742@rice.edu
Whole thread Raw
In response to Re: [GENERAL] view columm size.....  (Arnaud FLORENT <aflorent@iris-tech.fr>)
List pgsql-general
On Thu, Feb 10, 2000 at 05:17:18PM +0100, Arnaud FLORENT wrote:
> "Ross J. Reedstrom" a écrit :
>
> > On Thu, Feb 10, 2000 at 10:31:18AM +0100, Arnaud FLORENT wrote:
> > > hi,
> > >
> > Hmm, try something like:
> >
> > substr("ColView",1,12)
> >
> > That should give you the first 12 characters, i.e. all of them. See if
> > the UPDATE likes it.
>
> this works but i would like to understant this behaviour......
>
> i've got the same problem with a select into
> MAX( <char(12) column>) becomes a char (8190)!!!!!!!!!!!!
>

This depends on the field definitions you're using. The SQL standard
says that CHAR(X) values will be padded with whitespace to the full
column width. Sometimes, when moving data around, one needs to be
careful where it's going to be expanded, and were not. Usually, I don't
need the whitespace at all, so I can fix things with btrim() (removes
whitespace from both ends)

Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005

pgsql-general by date:

Previous
From: "Martin Kresse"
Date:
Subject: How to quietly increment a SEQUENCE
Next
From: Ed Loehr
Date:
Subject: Re: [GENERAL] Vacuum goes into spin