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

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: (view raw, whole thread or download thread mbox)
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.




pgsql-novice by date

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

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