Re: Data Types

From: "Roberts, Jon" <Jon(dot)Roberts(at)asurion(dot)com>
To: <mgould(at)allcoast(dot)net>, "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Data Types
Date: 2008-06-23 18:50:29
Message-ID: 1A6E6D554222284AB25ABE3229A92762E9A584@nrtexcus702.int.asurion.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Character will use more disk space than varchar so it does make a
difference.

http://www.postgresql.org/docs/8.3/interactive/datatype-character.html

Values of type character are physically padded with spaces to the
specified width n, and are stored and displayed that way. However, the
padding spaces are treated as semantically insignificant. Trailing
spaces are disregarded when comparing two values of type character, and
they will be removed when converting a character value to one of the
other string types. Note that trailing spaces are semantically
significant in character varying and text values.

Jon

________________________________

From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Mike Gould
Sent: Monday, June 23, 2008 1:01 PM
To: pgsql-general General
Subject: [GENERAL] Data Types

We are converting our system from using Sybase's SQL Anywhere 10 to
PostGres 8.3. In SQL Anywhere there technically isn't any difference in
how a char and varchar is stored. They are all an array of char[1]. So
we always just defined everything as a char since right truncation is
the default.

In PostGres though if we are using a character type column to search
should we define that as a varchar or a char or does it make any
difference?

Best Regards

Michael Gould
Intermodal Software Solutions, LLC.

In response to

  • Data Types at 2008-06-23 18:00:46 from Mike Gould

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2008-06-23 18:51:39 Re: dbsize command
Previous Message Brad Nicholson 2008-06-23 18:44:25 Re: dbsize command