Skip site navigation (1) Skip section navigation (2)

Re: Data Types

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Data Types
Date: 2010-11-05 16:47:40
Message-ID: 20101105164740.GA5660@tux (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
ALT SHN <i(dot)geografica(at)alt-shn(dot)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[]);
test=*# insert into Paleosites values (array['dinossauria','crocodilia','plantae']);
test=*# select * from Paleosites;
(1 Zeile)

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

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°

In response to

pgsql-novice by date

Next:From: Jean-Yves F. BarbierDate: 2010-11-05 16:52:43
Subject: Re: Data Types
Previous:From: Oliveiros d'Azevedo CristinaDate: 2010-11-05 16:40:50
Subject: Re: Data Types

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group