Re: Select For Update and Left Outer Join

From: Jim Nasby <jim(at)nasby(dot)net>
To: Patrick Earl <patearl(at)patearl(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Select For Update and Left Outer Join
Date: 2011-05-03 00:27:11
Message-ID: 4F418A62-BEB6-4D77-A0F1-B8DF27F211BF@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On May 1, 2011, at 12:27 PM, Patrick Earl wrote:
> In ORMs like NHibernate, there are a few strategies for mapping
> inheritance to SQL. One of these is "Joined Subclass," which allows
> for the elimination of duplicate data and clean separation of class
> contents.
>
> With a class hierarchy such as this:
>
> Pet
> Dog : Pet
> Cat : Pet
>
> The query to get all the pets is as follows:
>
> select * from Pet
> left join Dog on Dog.Id = Pet.Id
> left join Cat on Cat.Id = Pet.Id

Since FOR UPDATE seems to be a dead end here...

Is that construct something that NHibernate natively understands? If so, could you use Postgres table inheritance instead of joins?
--
Jim C. Nasby, Database Architect jim(at)nasby(dot)net
512.569.9461 (cell) http://jim.nasby.net

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2011-05-03 00:39:17 Re: Extreme bloating of intarray GiST indexes
Previous Message David Fetter 2011-05-02 21:56:01 Re: FDW table hints