Primary keys in a single column table and text vs varchar

From: matty jones <urlugal(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Primary keys in a single column table and text vs varchar
Date: 2011-02-01 00:54:27
Message-ID: AANLkTinBzLwNo8raW-iqvursq_rey3nG=wkXxy0J6+cn@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am designing a table that will hold a list of unique names and be
referenced by several other tables. There will only be one column in the
table (name), should I still create a separate primary key for that column
or can I use the name column as my key. I have also been reading a lot
about the differences between varchar and text and was wondering if there is
a downside to using text. The column I want to use text on (notes) will
hold a string that could be any length, I can use varchar(255) but I am
worried about the text being truncated or of the queries giving errors when
I try to output the text. I understand there is a mathematical limit to how
much can be stored in a single entry but I wasn't sure of any downsides to
just defaulting to text when possible.

Thanks,

Matt

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bruce Momjian 2011-02-01 03:54:33 Re: Postgresql security checks
Previous Message Tom Lane 2011-02-01 00:02:26 Re: [HACKERS] systable_getnext_ordered