Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#37903 closed enhancement (fixed)

SQL Consistency ...

Reported by: scrappyhuborg's profile scrappy@… Owned by: dd32's profile dd32
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Query Keywords:
Focuses: Cc:

Description

I've been working on pg4wp in order to have it work with both WP 4.6 and PostgreSQL 9.5 ... running the regression tests, I've come across what appears to be the only occurance of the use of && instead of AND in the SQL code ...

I realize that this works under MySQL, but would appreciate it if it was possible to have it changed to SQL Standard AND ...

I have attached a patch against 4.6 ... the code is in wp-include/query.php

Thank you for your consideration ...

Attachments (1)

query.p1 (920 bytes) - added by scrappy@… 8 years ago.
Patch for query.php to replace && with AND for SQL

Download all attachments as: .zip

Change History (3)

@scrappy@…
8 years ago

Patch for query.php to replace && with AND for SQL

#1 @dd32
8 years ago

  • Milestone changed from Awaiting Review to 4.7
  • Owner set to dd32
  • Status changed from new to accepted

Hi @scrappy@… and welcome to Trac :)

I see no reason why we shouldn't be consistent here, I can't find any other occurrences of && in SQL in core, although I can see a few plugins which use the syntax.

I'd highly suggest adding a conversion for the standard MySQL logic syntaxes, just as plugins are going to do what plugins do :)

Introduced with [36138] in 4.5.

#2 @dd32
8 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 38491:

Query: Use AND in a SQL query rather than &&.
This appears to have been the only instance of && being used in SQL, so for consistency lets remove it.

Props scrappy@….
Fixes #37903.

Note: See TracTickets for help on using tickets.