Hi all,
I have the following query:
(SELECT DISTINCT ON(document_date,transaction_document_id,transaction_id) transaction_id FROM acc_transactions,acc_documents WHERE
((transaction_document_id = document_id AND (date_trunc('day',document_date) BETWEEN '2007-01-01' AND '2007-08-15') AND
document_type NOT IN ('Delivery Note','Pro-Forma Invoice','Quote') AND document_customer_id = 4413 AND (document_outstanding <> 0 OR document_type = 'Payment on Account'))
OR (transaction_document_consolidated_id = document_id AND transaction_document_consolidated_id NOTNULL AND (date_trunc('day',document_date) BETWEEN '2007-01-01' AND '2007-08-15')
AND document_customer_id = 4413 AND document_outstanding <> 0)) ORDER BY document_date,transaction_document_id) UNION SELECT transaction_id FROM acc_transactions WHERE transaction_type_id = 62
AND date_trunc('day',transaction_date) BETWEEN '2007-01-01' AND '2007-08-15' AND transaction_customer_id = 4413
It executes in 120 ms from pgAdmin.
In Servoy,
(SELECT DISTINCT ON(document_date,transaction_document_id,transaction_id) transaction_id FROM acc_transactions,acc_documents WHERE
((transaction_document_id = document_id AND (date_trunc('day',document_date) BETWEEN ? AND ?) AND
document_type NOT IN ('Delivery Note','Pro-Forma Invoice','Quote') AND document_customer_id = ? AND (document_outstanding <> 0 OR document_type = 'Payment on Account'))
OR (transaction_document_consolidated_id = document_id AND transaction_document_consolidated_id NOTNULL AND (date_trunc('day',document_date) BETWEEN ? AND ?)
AND document_customer_id = ? AND document_outstanding <> 0)) ORDER BY document_date,transaction_document_id) UNION SELECT transaction_id FROM acc_transactions WHERE transaction_type_id = 62
AND date_trunc('day',transaction_date) BETWEEN ? AND ? AND transaction_customer_id = ?
with params
[Mon Jan 01 2007 00:00:00 GMT-0000 (GMT),Wed Aug 15 00:00:00 BST 2007,4413,
Mon Jan 01 2007 00:00:00 GMT-0000 (GMT),Wed Aug 15 00:00:00 BST 2007,4413,
Mon Jan 01 2007 00:00:00 GMT-0000 (GMT),Wed Aug 15 00:00:00 BST 2007,4413]
Freezes Servoy Developer (Mac OS X) and crashes Servoy client (Win XP)
I’m executing with
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, args, 10000);
The only thing I can think of is that Servoy is unhappy with the dates, which are coming from two DATETIME globals in Servoy.
Any ideas?