Query Builder issue, not returning results

Questions and answers regarding general SQL and backend databases

Query Builder issue, not returning results

Postby joe26 » Mon May 17, 2021 1:37 pm

Hi guys,

We've moved to higher versions of Postgres, and I'm seeing what used to work at 9.5, isn't at 10.

Running 2020.09 and the following used to give me a count with Query Builder...

Code: Select all
   var n = databaseManager.createSelect('db:/stsservoy/sheets');
   n.where.add(n.columns.sheet_number.eq(record.sheet_number));
   n.where.add(n.columns.tenant_uuid.eq(globals.makeUUID(globals.session.tenant_uuid)));
   n.where.add(n.columns.job_id.eq(globals.makeUUID(scopes.jobs.importJob.jobId)));
   /** @type {QBJoin<db:/stsservoy/piecemarks>} */
   var t = n.joins.add('db:/stsservoy/piecemarks');
   t.on.add(t.columns.sheet_id.eq(n.columns.sheet_id));
   n.root.where.add(t.columns.piecemark.eq(record.piecemark));
   n.root.where.add(t.columns.parent_piecemark.eq(record.parent_piecemark));
   var T = databaseManager.getFoundSet(n);


I'm checking the forums, but nothing new yet.

Just trying to get a count of existing records, of which this is but a part, but the join doesn't work.

Checking here to see if anyone actually uses query builder and where there might be a better resource as to debugging.

I should get a joined record, but result is only the sheets record.

Thanks,
--Joe.
joe26
 
Posts: 172
Joined: Wed Jun 19, 2013 10:30 pm

Re: Query Builder issue, not returning results

Postby rgansevles » Mon May 17, 2021 9:51 pm

Joe,

Do you see the actual sql that is executed?
You can see it from the admin page.

Also, check the startup logging, does it say anything about a dialect?
Maybe the database is not recognized as Postgres.

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1929
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: Query Builder issue, not returning results

Postby joe26 » Tue May 18, 2021 5:15 am

Hi Rob,

Thanks for the quick reply.

On some selected records, I get the correct joins. On others, it doesn't.

I'll post more when I analyze it.

This is an imported file from a customer through PgAdmin v4.5.

I'm not sure where the diags go when in Servoy Developer.

Thanks,
--Joe.
joe26
 
Posts: 172
Joined: Wed Jun 19, 2013 10:30 pm


Return to SQL Databases

Who is online

Users browsing this forum: Google [Bot] and 9 guests

cron