Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 5E5C5632FF2 for ; Fri, 11 Dec 2009 06:20:46 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 47189-09 for ; Fri, 11 Dec 2009 10:20:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mail.postgresql.org (Postfix) with SMTP id 7388C632CEC for ; Fri, 11 Dec 2009 06:20:38 -0400 (AST) Received: (qmail invoked by alias); 11 Dec 2009 10:20:35 -0000 Received: from i59F79F92.versanet.de (EHLO [192.168.1.113]) [89.247.159.146] by mail.gmx.net (mp006) with SMTP; 11 Dec 2009 11:20:35 +0100 X-Authenticated: #14269776 X-Provags-ID: V01U2FsdGVkX18MKqgUrhMMdvJyKb6cf8zC1c+84ChF3tWGkvq7iB 9M+AtrMEjJsW6v Message-ID: <4B221CFF.4060200@gmx.net> Date: Fri, 11 Dec 2009 11:20:47 +0100 From: Andreas User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: PostgresSQL list Subject: Re: Re: constants in 2-column foreign keys or how to design a storage for text-groups ? References: <4B1EED62.6050600@gmx.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.65 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200912/35 X-Sequence-Number: 33473 Jasen Betts schrieb: > On 2009-12-09, Andreas 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.