WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#3091 closed defect (bug) (fixed)

_max_num_pages can create ambiguities (and thereby db errors)

Reported by: filosofo Owned by: anonymous
Priority: normal Milestone: 2.1
Component: Administration Version: 2.1
Severity: normal Keywords: bg|has-patch _max_num_pages db
Cc:

Description

By using this expression: "SELECT COUNT(DISTINCT ID)" the function _max_num_pages creates an ambiguity any time a db request has joined the users and posts tables, as both tables have ID fields.

(This could happen for example if you're trying to return posts based on a search of user names.)

Since the ID in _max_num_pages could not be used for any other field than that of ID in the posts table, there's no reason not to disambiguate it, as my patch does.

Attachments (1)

link-template.php.diff (679 bytes) - added by filosofo 7 years ago.

Download all attachments as: .zip

Change History (2)

filosofo7 years ago

comment:1 ryan7 years ago

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

(In [4155]) Resolve table ambiguity.Props filosofo. fixes #3091

Note: See TracTickets for help on using tickets.