Re: BUG #3277: error occurs between different versions - Mailing list pgsql-bugs

From Klint Gore
Subject Re: BUG #3277: error occurs between different versions
Date
Msg-id 46525825125.7697KG@129.180.47.120
Whole thread Raw
In response to Re: BUG #3277: error occurs between different versions  (Klint Gore <kg@kgb.une.edu.au>)
Responses Re: BUG #3277: error occurs between different versions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
I'm suprised it worked in 8.0.  You should have got column reference is
ambiguous errors on seri_no since it appears in both dokuman and
onay_durum and there are 3 places where you don't specify which one you
want.  (Someone who knows more than I do might comment on what happens
to unqualfied field names when the add missing from brings in another
field with the same name?)

try fully qualifying where everything comes from.

select
    ??.seri_no,
    ???.ad as baslik,
    ????.kull_ref as Kullan=FDc=FD_Referansi,
    ?????.sorumlu

>from onay,
     dokuman,
     onay_durum
where onay_durum.p_id=3D'yonetici'
and onay.dokuman_id=3Ddokuman.seri_no
and onay_durum.seri_no=3D??????.seri_no
and onay_durum.p_id=3D'yonetici'
and (
   dokuman.durum=3D1
   or dokuman.durum=3D2
   or dokuman.durum=3D6
   or dokuman.durum=3D7)
and onay_durum.durum=3D0
and ???????.seri_no>0

klint.

On Mon, 21 May 2007 13:15:01 +0300, "nilay =E7eter" <nilayceter@gmail.com>
wrote:
> Yes,it is the same query, and had worked on PostgreSQL8.0 ,but although I
>  had already added "onay_durum"  to from clause and it did not work on 8.=
2,I
> have changed the 'add_missing_from =3D off '  to on in conf. file but
> it didn't work too.
> I have no idea about what to do:(
>
> 2007/5/14, Klint Gore <kg@kgb.une.edu.au>:
> >
> > On Mon, 14 May 2007 09:44:05 +0100, Heikki Linnakangas <
> > heikki@enterprisedb.com> wrote:
> > > Nilay Ceter wrote:
> > > > The command line:
> > > >
> > > > select seri_no, ad as baslik, kull_ref as Kullan=FDc=FD_Referansi, =
sorumlu
> > > > from onay,dokuman where p_id=3D'yonetici' and
> > onay.dokuman_id=3Ddokuman.seri_no
> > > > and onay_durum.seri_no=3Dseri_no and onay_durum.p_id=3D'yonetici' a=
nd
> > > > (dokuman.durum=3D1 or dokuman.durum=3D2 or dokuman.durum=3D6 or
> > dokuman.durum=3D7)
> > > > and onay_durum.durum=3D0 and seri_no>0
> > > >
> > > >
> > > > was working properly in Postgre SQL 8.0 but in version Postgre SQL =
8.2the
> > > > second "and" gives an error.
> > > > And it is :
> > > >
> > > > " Project dym.exe raised exception class EPSQLDatabaseError with
> > message
> > > > 'PostgreSQL Error Code : (1)
> > > > ERROR: missing FROM-clause entry for table "onay_durum" at character
> > 152'
> > > > .Process stopped.Use Step or Run to continue. "
> > >
> > > I don't understand how that query could have worked on PostgreSQL 8.0
> > > either. There's no table or alias with name "onay_durum" in the FROM
> > clause.
> > >
> > > Are you sure this is the exactly same query you tried on PostgreSQL 8=
.0?
> >
> > Didn't the default in postgresql.conf for add_missing_from change in 8.=
1?
> >
> > klint.

+---------------------------------------+-----------------+
: Klint Gore                            : "Non rhyming    :
: EMail   : kg@kgb.une.edu.au           :  slang - the    :
: Snail   : A.B.R.I.                    :  possibilities  :
: Mail      University of New England   :  are useless"   :
:           Armidale NSW 2351 Australia :     L.J.J.      :
: Fax     : +61 2 6772 5376             :                 :
+---------------------------------------+-----------------+

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #3295: pg_get_serial_sequence returns wrong sequence name for a serial column
Next
From: Tom Lane
Date:
Subject: Re: BUG #3277: error occurs between different versions