Automattic / HyperDB

HyperDB is an advanced database class that supports replication, failover, load balancing, and partitioning.
105 stars 22 forks source link

Users queries can skip the SQL_CALC_FOUND_ROWS queries #136

Open dd32 opened 1 year ago

dd32 commented 1 year ago

Running a query such as the following, followed by a SELECT FOUND_ROWS() will result in an error, and the found rows not being returned.

SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_users.ID FROM wp_users WHERE 1....

results in this error:

Attempted SELECT FOUND_ROWS() without prior SQL_CALC_FOUND_ROWS.

For an example of code that can trigger this, see https://github.com/WordPress/wporg-mu-plugins/pull/412