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

Display Length Between Var & Varchar

From: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
To: "PostgreSQL (SQL)" <pgsql-sql(at)postgresql(dot)org>
Subject: Display Length Between Var & Varchar
Date: 2012-02-01 04:08:06
Message-ID: CAAQLLO6wQ0b--_Y1LVR5S68HW6Wi7msOAmvELhaLE7cNmOtFCw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-sql
I've noticed when I set a field to char, it takes up lots of space over varchar:

iamunix=# SELECT * FROM music;
 id |       band        |          album           |    date    |
                  asin                        |    label
----+-------------------+--------------------------+------------+----------------------------------------------------+--------------
  1 | Dance Gavin Dance | Downtown Battle Mountain | 2007-05-15 |
B000OQF4PQ                                         | Rise Records
(1 row)

iamunix=# SELECT * FROM music;
 id |       band        |          album           |    date    |
asin    |    label
----+-------------------+--------------------------+------------+------------+--------------
  1 | Dance Gavin Dance | Downtown Battle Mountain | 2007-05-15 |
B000OQF4PQ | Rise Records
(1 row)

I don't know how well it will show in plain text via email but does
anyone know why the field display width is wasted with so much white
space when set to char?

Responses

pgsql-sql by date

Next:From: Adrian KlaverDate: 2012-02-01 04:13:53
Subject: Re: Display Length Between Var & Varchar
Previous:From: chester c youngDate: 2012-02-01 00:42:10
Subject: Fw: Re: pg_dump not correctly saving schema with partitioned tables?

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