Re: How would I store little key-Nr to text lists?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andreas <maps(dot)on(at)gmx(dot)net>
Cc: postgres list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: How would I store little key-Nr to text lists?
Date: 2010-07-10 09:02:23
Message-ID: AANLkTinXs4rT1hIuzG-uas7XU6Y3sYeL6aSPc1SqbvY_@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2010/7/10 Andreas <maps(dot)on(at)gmx(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Campbell, Lance 2010-07-13 14:58:53 subtract two dates to get the number of days
Previous Message Andreas 2010-07-10 07:57:23 How would I store little key-Nr to text lists?