Re: Why is MySQL more chosen over PostgreSQL? - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Why is MySQL more chosen over PostgreSQL?
Date
Msg-id 200208021053.30200.list-pgsql-hackers@empires.org
Whole thread Raw
In response to Re: Why is MySQL more chosen over PostgreSQL?  ("Sander Steffann" <steffann@nederland.net>)
Responses Re: Why is MySQL more chosen over PostgreSQL?  (Rod Taylor <rbt@zort.ca>)
List pgsql-hackers
> Well, if you also have soundcard_products, in your example you could have a
> product which is both a networkcard AND a soundcard. No way to restrict
> that a product can be only one 'subclass' at a time... If you can make that
> restriction using the relational model, you can do the same as with
> subclasses. But afaict that is very hard to do...
>

Perhaps I'm mistaken, but it looks to me as if the relational model still 
holds quite cleanly. 

CREATE TABLE products (
id int4 primary key,
name text );

CREATE TABLE soundcard (
prod_id int4 REFERENCES products(id),
some_feature BOOLEAN);

CREATE VIEW soundcard_v AS SELECT * FROM products, soundcard WHERE products.id 
= soundcard.prod_id;

CREATE TABLE networkcard (
prod_id int4 REFERENCES products(id),
hundred_base_t BOOLEAN);

CREATE VIEW networkcard_v AS SELECT * FROM products, networkcard WHERE 
products.id = networkcard.prod_id;

Now, to get the networkcard/soundcard combos, you just need to do:
SELECT * FROM soundcard_v, networkcard_v WHERE soundcard_v.id = 
networkcard_v.id;

For what it's worth, I didn't make any mistakes writing it up the first time. 
It most certainly "fits my brain" well and seems simple and clean.

I am not advocating that we remove inheritance, but I (so far) agree with Curt 
that it's pretty useless.

Regards,Jeff



pgsql-hackers by date:

Previous
From: "Jeroen T. Vermeulen"
Date:
Subject: Re: Trim the Fat (Was: Re: Open 7.3 items )
Next
From: Andrew Sullivan
Date:
Subject: Re: FUNC_MAX_ARGS benchmarks