Re: Fwd: Bad Join moment - how is this happening? - Mailing list pgsql-sql

From Christoph Haller
Subject Re: Fwd: Bad Join moment - how is this happening?
Date
Msg-id 3F28E19A.1D589548@rodos.fzk.de
Whole thread Raw
In response to Fwd: Bad Join moment - how is this happening?  (Jamie Lawrence <postgres@jal.org>)
List pgsql-sql
> I have a view:
>
> create or replace view addenda as
> select
>         documents.id,
>         documents.oid,
>         documents.projects_id,
>         documents.doc_num,
>         documents.description,
>         documents.date,
>         documents.createdate,
>         documents.moddate,
>         documents.people_id,
>         documents.parent,
>         documents.document_type,
>         documents.state,
>         documents.machines_id,
>         documents.phases_id,
>
>         d_addenda.item_num,
>         d_addenda.drawing_reference
>
> from
>         d_addenda as a, documents as d
>                 where a.documents_id =  d.id;
>
Doing this you should have got
NOTICE:  Adding missing FROM-clause entry for table "d_addenda"
NOTICE:  Adding missing FROM-clause entry for table "documents"
So it's pretty useful to write psql's output to a file when creating
relations
and check for NOTICE messages.

exec 3>/tmp/psql.out;$PGSQLD/bin/psql <your options here>  1>&3 2>&3

NOTICE messages appear to be sent to stderr.

As the previous posters already made clear
create or replace view addenda as
select       documents.id,       documents.oid,       documents.projects_id,       documents.doc_num,
documents.description,      documents.date,       documents.createdate,       documents.moddate,
documents.people_id,      documents.parent,       documents.document_type,       documents.state,
documents.machines_id,      documents.phases_id,
 
       d_addenda.item_num,       d_addenda.drawing_reference

from       d_addenda , documents               where d_addenda.documents_id =  documents.id;
resp.
create or replace view addenda as
select       d.id,       d.oid,       d.projects_id,       d.doc_num,       d.description,       d.date,
d.createdate,      d.moddate,       d.people_id,       d.parent,       d.document_type,       d.state,
d.machines_id,      d.phases_id,
 
       a.item_num,       a.drawing_reference

from       d_addenda as a, documents as d               where a.documents_id =  d.id;
should match your intentions.

Regards, Christoph




pgsql-sql by date:

Previous
From: "rute solipa"
Date:
Subject: Unsubscribe
Next
From: "vijaykumar M"
Date:
Subject: problem in database backup