Re: How would I store little key-Nr to text lists? - Mailing list pgsql-sql

From Pavel Stehule
Subject Re: How would I store little key-Nr to text lists?
Date
Msg-id AANLkTinXs4rT1hIuzG-uas7XU6Y3sYeL6aSPc1SqbvY_@mail.gmail.com
Whole thread Raw
In response to How would I store little key-Nr to text lists?  (Andreas <maps.on@gmx.net>)
List pgsql-sql
2010/7/10 Andreas <maps.on@gmx.net>:
>  Hi
>
> how would I store little key-Nr  to  text  lists?
> Like e.g.
>
> colors
> 1  red
> 2  green
> 3  blue
>
> Maybe I later also need to add  4 yellow?
>
> Obviously the numbers are used for foreign keys in data tables and the texts
> appear in selects.
> On the other hand users should chose from listboxes in an application so I
> need to be able to read the (key, ext) tupels.
>
> For now I use 2 column tables that in selects get joined to a data table.
>
> Is there a more clever way ?

you can use enums, you can use a hstore contrib module, but what you
doing is best

regards

Pavel Stehule


>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>


pgsql-sql by date:

Previous
From: Andreas
Date:
Subject: How would I store little key-Nr to text lists?
Next
From: "Campbell, Lance"
Date:
Subject: subtract two dates to get the number of days