Re: Database design? - Mailing list pgsql-general

From Aasmund Midttun Godal
Subject Re: Database design?
Date
Msg-id 20011023164200.22669.qmail@ns.krot.org
Whole thread Raw
In response to Re: Database design?  ("Ernesto Baschny" <ernst@baschny.de>)
List pgsql-general
You can insert values into this structure which have the same id...

INSERT INTO books (id) values (1);
INSERT INTO cds (id) values (1);

Which may be a problem (which may fix :)

Regards,

Aasmund.
On Tue, 23 Oct 2001 16:43:29 +0200, "Ernesto Baschny" <ernst@baschny.de> wrote:
> On 23 Oct 2001 at 9:11, Johnny Jørgensen wrote:
>
> rdbm
> book,author,country,cd,publisher)
> therefore can't
> description. Thing
> different
> i've figured
> tables as
> relation.
> reference more
> e-book, a
> them.
> description
>
> Maybe you could use inherited tables to achieve that.
>
> CREATE TABLE items (
>   id SERIAL,
>   description TEXT,
>
>   PRIMARY KEY (id)
> )
>
> CREATE TABLE books (
>   isbn VARCHAR(15),
>   other_field INTEGER,
>   ...
>
> ) INHERITS (items);
>
> CREATE TABLE cds (
>   title VARCHAR(15),
>   ...
>
> ) INHERITS (items);
>
> With this you can define the "general" attributes in the
> "items" table and more specific things in the specific tables.
>
> The primary key for all those tables will be kept unique
> across tables, since they will all refer to the same
> SEQUENCE.
>
> Maybe there are more elegant and correct solutions, I am
> just beginning my jorney to the PgSQL world (this, for
> example, couldn't be done with MySQL).
>
> --
> Ernesto Baschny <ernst@baschny.de>
>  http://www.baschny.de - PGP Key:
> http://www.baschny.de/pgp.txt
>  Sao Paulo/Brasil - Stuttgart/Germany
>  Ernst@IRCnet - ICQ# 2955403
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

Aasmund Midttun Godal

aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46

pgsql-general by date:

Previous
From: Keary Suska
Date:
Subject: Re: openssl & postgresql
Next
From: Martin Weinberg
Date:
Subject: Re: Using an SMP machine to make multiple indices on the