Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id A688F15B1511 for ; Wed, 1 Feb 2012 00:15:59 -0400 (AST) Received: from mail-iy0-f174.google.com ([209.85.210.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RsRby-0004K8-Jt for pgsql-sql@postgresql.org; Wed, 01 Feb 2012 04:15:59 +0000 Received: by iacb35 with SMTP id b35so901664iac.19 for ; Tue, 31 Jan 2012 20:15:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; bh=Jhe5x3aQH15dTWVgC/2Sx3LlBsosk4bSyh+1R+paSsI=; b=Enatt/sBlE+mQxqHYMk3sHWjWboqyQmaV6YVMg/UXJwK+35aBFai3tpaKeYrq9gcbg +7jGmM5Ubnx5iAjYdgRkxvmTUJ3rfcyBurUaQz103i3L2QXekp4u5wyCjs8ds/Tjv0Qm Tu/ZqSLhW85LrBJbE25hEHG2/JiYjnk6Rg6lU= Received: by 10.50.170.97 with SMTP id al1mr5195373igc.1.1328069746136; Tue, 31 Jan 2012 20:15:46 -0800 (PST) Received: from tucker.localnet (c-24-17-164-54.hsd1.wa.comcast.net. [24.17.164.54]) by mx.google.com with ESMTPS id k3sm4777548igq.1.2012.01.31.20.15.44 (version=SSLv3 cipher=OTHER); Tue, 31 Jan 2012 20:15:45 -0800 (PST) From: Adrian Klaver To: pgsql-sql@postgresql.org Subject: Re: Display Length Between Var & Varchar Date: Tue, 31 Jan 2012 20:13:53 -0800 User-Agent: KMail/1.13.5 (Linux/2.6.32-38-generic; KDE/4.4.5; i686; ; ) Cc: Carlos Mennens References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201201312013.53423.adrian.klaver@gmail.com> X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201202/2 X-Sequence-Number: 36295 On Tuesday, January 31, 2012 8:08:06 pm Carlos Mennens wrote: > 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? You will find that the Manual is very helpful in this regard:) http://www.postgresql.org/docs/9.0/interactive/datatype-character.html character varying(n), varchar(n) variable-length with limit character(n), char(n) fixed-length, blank padded -- Adrian Klaver adrian.klaver@gmail.com