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

Re: [HACKERS] Re: Join/table alias bug

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Adriaan Joubert <a(dot)joubert(at)albourne(dot)com>, pgsql-hackers(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [HACKERS] Re: Join/table alias bug
Date: 2000-09-30 02:45:32
Message-ID: 200009300245.WAA03557@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
Yes, this is what was eventually done... only emit warnings for tables
already in the RTE, as Tom mentioned.


> Peter Eisentraut <e99re41(at)DoCS(dot)UU(dot)SE> writes:
> > ... The reason this behaves that way is because queries
> > without from lists (SELECT my_tbl.a) are valid in PostgreSQL for
> > historical reasons, so we're stuck with it.
> 
> Not only for historical reasons: there are cases where it allows you
> to do things you couldn't easily do otherwise.  An example is deleting
> using a join:
> 
> 	DELETE FROM target WHERE field1 = source.field2
> 
> which deletes any record in target whose field1 matches any field2
> value in source.  This isn't SQL92 since DELETE doesn't allow you
> to specify any tables except the target table in FROM.  (Yeah,
> I know this example could be written with a subselect --- but with
> a more complex WHERE condition it gets harder to do that.  Also
> slower.)
> 
> > We've pondered many times about emitting warnings but a definite
> > consensus was never reached.
> 
> Bruce had actually put in some code to emit warnings, but Thomas
> objected to it for reasons I don't recall clearly.  I think it was
> an implementation issue rather than objecting to the idea of having
> warnings.  AFAIR we had pretty much agreed that a warning would be
> a good idea.
> 
> IIRC, Bruce's code would emit a warning whenever an implicit RTE was
> added.  I think that might be overly verbose --- I'd be inclined to
> warn only in the case that an implicit RTE is added for a table that
> has an RTE already (under a different alias).  That is the only
> situation I've seen user complaints about.
> 
> 			regards, tom lane
> 


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

In response to

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2000-09-30 02:47:54
Subject: Re: memory management suggestion
Previous:From: Bruce MomjianDate: 2000-09-30 02:37:30
Subject: Re: Suggested change in include/utils/elog.h

pgsql-bugs by date

Next:From: pgsql-bugsDate: 2000-09-30 06:36:19
Subject: after trigger not working in begin-commit block
Previous:From: Bruce MomjianDate: 2000-09-30 02:32:29
Subject: Re: grant/revoke bug with delete/update

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