loopbackio/loopback-connector-postgresql

Facing issue while running a query

himanshunagda opened this issue · 3 comments

I have collection of records stored on postgresql and i am trying to retrieve records using where filter with gte(greater than equal to operator).

Query1--->SELECT * FROM schema.blocks WHERE block -> 'height' ->> 'low' >= '12';

Query2-->SELECT * FROM schema.blocks WHERE CAST(block -> 'height' ->> 'low' AS Integer) >= 12;

whenever I am running this query in nodejs:
let result = await Blocks.find({ where: { 'block.height.low': { gte: height } }});

I am getting wrong result (result of Query1) but when i use CAST as in Query2 in the above example, i am getting correct results.

There are some issue with the loopback postgresql connector as "let result = await Blocks.find({ where: { 'block.height.low': { gte: height } }})" always runs query1 which is not a correct result and in my opinion it should run query2 as it is giving correct result.

loopback-connector-postgresql version-- 3.9.1

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale commented

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.