From: Andreas <maps.on@gmx.net>
To: PostgresSQL list <pgsql-sql@postgresql.org>
Subject: Re: Re: constants in 2-column foreign keys or how to design a storage for text-groups ?
Date: Fri, 11 Dec 2009 11:20:47 +0100
Message-ID: <4B221CFF.4060200@gmx.net> (raw)
In-Reply-To: <hft0gj$2j5$1@reversiblemaps.ath.cx>
References: <4B1EED62.6050600@gmx.net>
<hft0gj$2j5$1@reversiblemaps.ath.cx>
Jasen Betts schrieb:
> On 2009-12-09, Andreas <maps.on@gmx.net> wrote:
> ...
>
>> stupid example:
>> ---------------
>> color: red, green, blue
>> size: tiny, little, big, giant
>> structure: hard, soft, floppy
>> How would I solve the rather common text storage issue?
>>
>
> have you considered using enumerated types instead?
Yes, but I need those texts in the GUI to show them as listboxes or
comboboxes.
There might be changes too when I later need to add or drop an option of
a group.
E.g. there are questionnaires to model.
Lets say 10 questions where each has a couple of predefined answers
where one should be selected.
So I've got to store every group of possible answers to a question
either in a seperate table or in a kind of repository all within one big
table (row_id, questionnare_id, question_id, answer_nr, answer)
The row_id so I just need to store 1 value per answer.
Now I've got to make sure that it is impossible that accidentally there
gets a question-17 answer connected to a question-42 and above all, that
the questions dont get mixed between the questionnaires.
I can do this with the frontend and enough hope that nothing bad will
happen.
Still I'd rather hardwire the integrity into the table design.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: maps.on@gmx.net
Subject: Re: Re: constants in 2-column foreign keys or how to design a storage for text-groups ?
In-Reply-To: <4B221CFF.4060200@gmx.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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