Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] char(8) vs char8

From: Byron Nikolaidis <byronn(at)insightdist(dot)com>
To: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] char(8) vs char8
Date: 1998-05-14 14:55:08
Message-ID: 355B05CC.350843F1@insightdist.com (view raw or flat)
Thread:
Lists: pgsql-hackers

D'Arcy J.M. Cain wrote:

> This was an unexpected difference between these two types and I wonder
> if it was meant to be this way.  Previously, a char8 field with the
> string 'abc' would return 'abc' as expected.  Now, with char(8), I get
> back 'abc     ' instead.  You can see this with my PygreSQL module
> or the C interface (which my module uses, of course.)  This causes a
> lot of my programs to break.
>

char(x) is the datatype 'bpchar' (blank padded char).  Thus it is padded
with spaces to the field width.

Couldn't you use something like "select rtrim(column) from table".  This
will trim the spaces off.

Byron


In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-05-14 14:55:34
Subject: Re: AW: [HACKERS] mmap and MAP_ANON
Previous:From: Bruce MomjianDate: 1998-05-14 14:54:09
Subject: Re: [HACKERS] Sequential scan speed, mmap, disk i/o

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group