Re: design question - newbie

From: Richard Huxton <dev(at)archonet(dot)com>
To: rob(at)benefitscheckup(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: design question - newbie
Date: 2002-08-07 08:24:11
Message-ID: 200208070924.12868.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday 02 Aug 2002 8:59 pm, rob(at)benefitscheckup(dot)org wrote:

> Obviously the problem with storing the results in this manner is that
> there is no way to check the integrity of 'response' field. I would
> have to store them all as strings. So if something messed up I could
> easily have a situation where it looked like a user had seen Batman true
> times or enjoyed the '15' batman movies. This seems very very bad.
>
> What am I missing?

Well - you're going to want to check things in your application anyway. You
could have seen batman -3.12 times, a valid number but not a valid answer.

After that, you could:

1. Define a new type that takes something like ('number','1') and checks that
'1' is a number.
2. Define a function to parse and check the supplied string for the right
format
3. Have multiple response fields: response_int, response_bool, response_text
etc. and try to put the value into the expected slot.

Since you say you're a newbie I'd probably check it all in the application -
easier.

- Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message frbn 2002-08-07 08:30:05 Re: COPY: how to use "," as a delimeter?
Previous Message Jean-Christian Imbeault 2002-08-07 07:29:45 COPY: how to use "," as a delimeter?