array column -- do you really want this? - Mailing list pgsql-sql

From Oliver Seidel
Subject array column -- do you really want this?
Date
Msg-id Pine.LNX.4.21.0009050930220.9722-100000@imr-int.intra.in-medias-res.com
Whole thread Raw
List pgsql-sql
Hello Umashankar,

*warning* this doesn't answer the question you asked *warning*

you write that you are new to object databases.  The problem that you
describe sounds like it might much more completely be solved by not using
the object features and avoiding an array alltogether.

If you simply wish to solve the problem, then I can recommend some reading
on normal forms, which goes into all the problems that can occur in
databases without consideration for storage anomalities.  You can find a
good article here:
http://home.earthlink.net/~billkent/Doc/simple5.htm

Your database would then be in "first normal form" and not contain lists
inside a field any more.  You simply create two columns, the first listing
the patient ID and the second listing the illness.  Patient IDs are
allowed to occur repeatedly.  You could retrieve all illnesses for a
particular patient by the use of:
select illness from patient_illness where patient_id=1434;

or you may retrieve all patients' illnesses by querying:
select * from patient_illness order by patient_id,illness;

I hope that helps,

Oliver



pgsql-sql by date:

Previous
From: Timothy Covell
Date:
Subject: HELP pg_proc is corrupted!
Next
From: Dana Hudes
Date:
Subject: Re: [ADMIN] 7.0.2 questions on encoding and compilation