[wp-trac] [WordPress Trac] #3091: _max_num_pages can create ambiguities (and thereby db errors)

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 1 08:51:56 GMT 2006


#3091: _max_num_pages can create ambiguities (and thereby db errors)
----------------------------+-----------------------------------------------
 Reporter:  filosofo        |       Owner:  anonymous                     
     Type:  defect          |      Status:  new                           
 Priority:  normal          |   Milestone:  2.1                           
Component:  Administration  |     Version:  2.1                           
 Severity:  normal          |    Keywords:  bg|has-patch _max_num_pages db
----------------------------+-----------------------------------------------
 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.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3091>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list