? ? Pending

User tests: Successful: Unsuccessful:

avatar SharkyKZ
SharkyKZ
24 Oct 2019

Summary of Changes

Fixes a couple of conditions that fail on PostgreSQL and MS SQL.

Testing Instructions

As a simple test, try these queries:

  1. SELECT * FROM #__content WHERE 0

  2. SELECT * FROM #__content WHERE 0 != 0

Expected result

No results returned and no errors.

Actual result

First query has errors.

On MSSQL:

An expression of non-boolean type specified in a context where a condition is expected, near '0'.

On PostgreSQL:

ERROR: argument of WHERE must be type boolean, not type integer Position: 33

Documentation Changes Required

No.

avatar SharkyKZ SharkyKZ - open - 24 Oct 2019
avatar SharkyKZ SharkyKZ - change - 24 Oct 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Oct 2019
Category Administration com_users Front End com_banners
avatar SharkyKZ SharkyKZ - change - 24 Oct 2019
Labels Added: ?
avatar richard67 richard67 - test_item - 24 Oct 2019 - Tested successfully
avatar richard67
richard67 - comment - 24 Oct 2019

I have tested this item successfully on c116c1b

Code review + I can confirm that this is the right, standard SQL way to do it for any kind of database, have some condition which resolves to false or true, depending on the purpose. I've had that problemn recently, too, and have fixed it in the same way. Is a very commong thing to use such conditions for such purpose.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26789.

avatar alikon alikon - test_item - 24 Oct 2019 - Tested successfully
avatar alikon
alikon - comment - 24 Oct 2019

I have tested this item successfully on c116c1b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26789.

avatar alikon alikon - change - 24 Oct 2019
Status Pending Ready to Commit
avatar alikon
alikon - comment - 24 Oct 2019

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26789.

avatar wilsonge
wilsonge - comment - 25 Oct 2019

Isn't this just places where we shouldn't be running queries to begin with rather than forcing queries to return empty results?

avatar richard67
richard67 - comment - 25 Oct 2019

Agree ... but better this PR like it is than SQL errors, that's why I gave it a good test.

Maybe @SharkyKZ wants to change it here to not run the query in case of false condition? Or make a new PR?

avatar SharkyKZ
SharkyKZ - comment - 25 Oct 2019

Yes, that would be better.

avatar SharkyKZ
SharkyKZ - comment - 28 Oct 2019

Closing this. Will make 2 separate PRs.

avatar SharkyKZ SharkyKZ - close - 28 Oct 2019
avatar SharkyKZ SharkyKZ - change - 28 Oct 2019
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2019-10-28 09:23:55
Closed_By SharkyKZ
Labels Added: ?

Add a Comment

Login with GitHub to post a comment