Re: Data Types - Mailing list pgsql-novice

From Andreas Kretschmer
Subject Re: Data Types
Date
Msg-id 20101105164740.GA5660@tux
Whole thread Raw
In response to Data Types  (ALT SHN <i.geografica@alt-shn.org>)
List pgsql-novice
ALT SHN <i.geografica@alt-shn.org> wrote:

> Hello List,
>
> I have a column of a table of paleontological sites named "Paleosites" wich has
> a column named "species". A paleosite can contain remais of one or more
> animals. So in that column sometimes I have to put this: dinossauria crocodilia
> plantae. This indicates that from a given paleosite were retrieved the remais
> of 3 different species.
>
> Now my question is: wich data type should the column "Species" be? Text?
> Varchar?

If i where you, maybe a text[]:

test=# create table Paleosites (species text[]);
CREATE TABLE
test=*# insert into Paleosites values (array['dinossauria','crocodilia','plantae']);
INSERT 0 1
test=*# select * from Paleosites;
             species
----------------------------------
 {dinossauria,crocodilia,plantae}
(1 Zeile)


Other solution: an extra table with a 1:m relationship.



Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

pgsql-novice by date:

Previous
From: "Oliveiros d'Azevedo Cristina"
Date:
Subject: Re: Data Types
Next
From: "Jean-Yves F. Barbier"
Date:
Subject: Re: Data Types