Re: LEFT JOIN used in psql describe.c

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Sabino Mullane <greg(at)turnstep(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: LEFT JOIN used in psql describe.c
Date: 2005-05-10 22:59:45
Message-ID: 200505102259.j4AMxje20865@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:
> Tom Lane wrote:
> > "Greg Sabino Mullane" <greg(at)turnstep(dot)com> writes:
> > >> Does anyone know why so many LEFT JOINs are used in psql/describe.c to
> > >> join to the pg_namespace table, like here:
> >
> > > Yes, pg_relnamespace is definitely not null. I've actually already removed
> > > the left joins from my \df patch, since I had to rewrite some of the
> > > queries anyway. If this is wrong, please let me know of course!
> >
> > I think the idea was to be certain to show every pg_proc entry (or other
> > catalog for other \d commands), no matter how badly broken the catalog
> > interrelationships might be. If there's not an unarguable reason
> > for eliminating the left joins I'd be inclined to keep it like that.
> > What does an inner join buy here, other than brittleness?
> >
> > (Yeah, I have the perspective of a developer who deals with broken
> > situations every day. So?)
>
> If we have problems with the system catalogs, I don't see how this join
> has a high probability of catching the problem. If there was some known
> problem of the join not always working, I could see the use of LEFT
> JOIN, but there isn't, so it just seems confusing, and these queries are
> used by others as models of how to do system joins, so could confuse our
> users as well.
>
> I think the LEFT JOIN should be removed unless there is a known problem,
> and if one shows up, we can re-add them later.

I still think that the LEFT JOINs used in psql system queries is
confusing and perhaps adds performance overhead while adding little
reliability, but no one else seems to think so so I will drop the idea.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Glaesemann 2005-05-10 23:09:50 Re: Views, views, views: Summary of Arguments
Previous Message Simon Riggs 2005-05-10 22:57:52 Re: Cost of XLogInsert CRC calculations