QBSelect with different schema

Questions and answers regarding general SQL and backend databases

QBSelect with different schema

Postby logicimpresa » Wed Feb 10, 2016 11:30 pm

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 3067 times


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

Thanks in advance
Gianluca Zanini
Logic Impresa - Italy
SAN Partner
Best BAP development 2014
Eager Beaver 2013
Servoy Valued Professional 2012
User avatar
logicimpresa
 
Posts: 65
Joined: Sun May 01, 2011 3:58 pm
Location: Bernate Ticino (MI) - Italy

Re: QBSelect with different schema

Postby sbutler » Thu Feb 11, 2016 12:45 pm

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.
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: QBSelect with different schema

Postby logicimpresa » Thu Feb 11, 2016 2:07 pm

Hy Scott,
The problem is that on the AS log does not appear the schema: it's a bug?
Gianluca Zanini
Logic Impresa - Italy
SAN Partner
Best BAP development 2014
Eager Beaver 2013
Servoy Valued Professional 2012
User avatar
logicimpresa
 
Posts: 65
Joined: Sun May 01, 2011 3:58 pm
Location: Bernate Ticino (MI) - Italy


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 5 guests

cron