AW: [HACKERS] char(8) vs char8

From: Andreas Zeugswetter <andreas(dot)zeugswetter(at)telecom(dot)at>
To: "'D'Arcy J(dot)M(dot) Cain'" <darcy(at)druid(dot)net>
Cc: "'hackers(at)postgresql(dot)org'" <hackers(at)postgresql(dot)org>
Subject: AW: [HACKERS] char(8) vs char8
Date: 1998-05-14 14:58:50
Message-ID: 01BD7F59.9CE62FB0@zeugswettera.user.lan.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> 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.

This is the expected behavior for the char() datatype. If you have other variable
length fields in the table, you can simply use varchar() which does not blank pad
to the specified length. If you don't have other variable length fields then you
loose some performance if you switch to varchar().

> I have made a quick change to my Python module to handle this. Should
> I clean it up or can I expect the behaviour to go back the way it was?

No, it will stay.

Andreas

Browse pgsql-hackers by date

  From Date Subject
Next Message Gran Thyni 1998-05-14 15:25:10 Re: AW: [HACKERS] mmap and MAP_ANON
Previous Message Bruce Momjian 1998-05-14 14:55:34 Re: AW: [HACKERS] mmap and MAP_ANON