pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How would I store little key-Nr  to  text  lists?
2+ messages / 2 participants
[nested] [flat]

* How would I store little key-Nr  to  text  lists?
@ 2010-07-10 07:57 Andreas <maps.on@gmx.net>
  2010-07-10 09:02 ` Re: How would I store little key-Nr to text lists? Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Andreas @ 2010-07-10 07:57 UTC (permalink / raw)
  To: pgsql-sql

  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 ?



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: How would I store little key-Nr to text lists?
  2010-07-10 07:57 How would I store little key-Nr  to  text  lists? Andreas <maps.on@gmx.net>
@ 2010-07-10 09:02 ` Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Pavel Stehule @ 2010-07-10 09:02 UTC (permalink / raw)
  To: Andreas <maps.on@gmx.net>; +Cc: 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
>



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2010-07-10 09:02 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-07-10 07:57 How would I store little key-Nr  to  text  lists? Andreas <maps.on@gmx.net>
2010-07-10 09:02 ` Re: How would I store little key-Nr to text lists? Pavel Stehule <pavel.stehule@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox