Page 1 of 1

QBSelect with different schema

PostPosted: Wed Feb 10, 2016 11:30 pm
by logicimpresa
Hi to all,
I try to use QBSelect from 2 table in 2 different schemas

Example:
Code: Select all
/** @type {QBSelect<db:/mydb1/table1>} */
var q = databaseManager.createSelect('db:/mydb1/table1')
/** @type {QBJoin<db:/mydb2/table2>} */
var join = q.joins.add('db:/mydb2/table2', JSRelation.LEFT_OUTER_JOIN)
join.on.add(join.columns.field1.eq(q.columns.field2))
q.result.add(q.columns.field3)


The AS error is:
ERROR: relation "mydb2" does not exist

But, if I use a databaseManager.getDatasetByQuery with this code run correctly:
Code: Select all
select table1.field3
from mydb1.table1
left outer join mydb2.table2 on table1.field1=mydb2.field2


The database server is configured as in this example:
Schermata 2016-02-10 alle 22.27.32.png
Schermata 2016-02-10 alle 22.27.32.png (117.23 KiB) Viewed 3107 times


Question: is it possible to use QBSelect in this case?

Thanks in advance

Re: QBSelect with different schema

PostPosted: Thu Feb 11, 2016 12:45 pm
by sbutler
So its really the same database but in a different schema? Consider adjusting the search path in postgress instead. Then you can treat all the tables as if they are in the same Db without the schema prefix.

Re: QBSelect with different schema

PostPosted: Thu Feb 11, 2016 2:07 pm
by logicimpresa
Hy Scott,
The problem is that on the AS log does not appear the schema: it's a bug?