Re: [HACKERS] SELECT BUG

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: "[Jos_] Soares" <jose(at)sferacarta(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] SELECT BUG
Date: 1999-09-07 15:39:56
Message-ID: 199909071539.LAA03078@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

[Charset iso-8859-1 unsupported, filtering to ASCII...]
>
>
> Tom Lane ha scritto:
>
> > =?iso-8859-1?Q?Jos=E9?= Soares <jose(at)sferacarta(dot)com> writes:
> > > And now the other SELECT bug in the same data:
> > > select master1.*, detail1.*
> > > from master1 m, detail1 d
> > > where trim(m.code)=trim(d.code);
> >
> > This one is definitely pilot error. Since you've renamed master1 and
> > detail1 in the FROM clause, your use of the original names in the SELECT
> > list is treated as adding more FROM items. Effectively your query is
> >
> > select m2.*, d2.*
> > from master1 m, detail1 d, master1 m2, detail1 d2
> > where trim(m.code)=trim(d.code);
> >
> > You're getting a four-way join with only one restriction clause...
> >
> > There was a thread just the other day about whether we ought to allow
> > queries like this, because of someone else making exactly the same
> > error. I believe allowing tables to be referenced without FROM entries
> > is a holdover from the old Postquel language that's not found in SQL92.
> > Maybe we should get rid of it on the grounds that it creates confusion.
> >
> > regards, tom lane
> >
> >
>
> PostgreSQL should raise a syntax error like Informix and Oracle do.

We sould at least give them an elog(NOTICE) to say we are doing
something special, no?

>
> > ************
> > INFORMIX:
> >
> > select master1.*, detail1.* from master1 m, detail1 d where mcode=dcode;
> > # ^
> > # 522: Table (master1) not selected in query.
> > #
> > ------------------------------------------------------------------------
> > ORACLE:
> >
> > select master1.*, detail1.* from master1 m, detail1 d where mcode=dcode
> > *
> > ERROR at line1:
> > ORA-00942: table or view does not exist
> >
> >
>
> Jos_
>
>
> ************
>
>

--
Bruce Momjian | http://www.op.net/~candle
maillist(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

Browse pgsql-hackers by date

  From Date Subject
Next Message Roberto Cornacchia 1999-09-07 19:15:37 Re: [HACKERS] optimizer pruning problem
Previous Message Tom Lane 1999-09-07 14:02:09 Re: [HACKERS] problem about message type 0x45