postgres 9.1 - querie problem using a dblink - Mailing list pgsql-admin

From Khangelani Gama
Subject postgres 9.1 - querie problem using a dblink
Date
Msg-id 93a59f416c27e4a0f50e82f29968ab1e@mail.gmail.com
Whole thread Raw
List pgsql-admin

Hi

 

Please help, when I run this querie I get an error saying : column "cdbs_br_cde" specified in USING clause does not exist in left table

 

The DATABASE LINK is called cen_8008.

 

 

select a.cdbs_br_cde as br_cde,

sum(case when b.value_type=107 then a.value else 0 end) as mtd_sog,

sum(case when b.value_type=110 then a.value else 0 end) as mtd_cos

from eis_mtd_sales@cen_8008 a

left join eis_value_types@cen_8008 b using (cdbs_br_cde,cdbs_grp_cde,value_type)

--left join eis_daily_sales@cen_8008 c on  (b.cdbs_br_cde=c.cdbs_br_cde and b.cdbs_grp_cde=c.cdbs_grp_cde and b.value_type=c.value_type and c.value_date::date=sysdate::date -interval '1 day')

where 1=1

--and a.cdbs_br_cde='8008'

and a.cdbs_grp_cde='1~7~1'

and a.fpp_cde='201412'

and a.value_type in (107,110)

group by a.cdbs_br_cde

order by a.cdbs_br_cde;

 

 

 

 

 

example on how I created the dblink for cent8008

 

CREATE public DATABASE LINK cen_8008 CONNECT TO user IDENTIFIED BY 'passwd' USING libpq 'host=IP port=3456 dbname=c8008';

 

 

 

 

 

 


CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the addressee only, and may contain the confidential
information of Argility (Proprietary) Limited and/or its subsidiaries. Any review, use or dissemination thereof by anyone
other than the intended addressee is prohibited.If you are not the intended addressee please notify the writer immediately
and destroy the e-mail. Argility (Proprietary) Limited and its subsidiaries distance themselves from and accept no liability
for unauthorised use of their e-mail facilities or e-mails sent other than strictly for business purposes.

pgsql-admin by date:

Previous
From: fahad basheer
Date:
Subject: Postgresl Load Balancer
Next
From: Khangelani Gama
Date:
Subject: Re: postgres 9.1 - querie problem using a dblink