[wp-trac] [WordPress Trac] #57767: SQL query error with multiple order specifications in pre_get_posts.

WordPress Trac noreply at wordpress.org
Mon Feb 20 03:57:42 UTC 2023


#57767: SQL query error with multiple order specifications in pre_get_posts.
--------------------------+------------------------------
 Reporter:  kuroro111     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  6.1.1
 Severity:  critical      |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Description changed by Otto42:

Old description:

> https://onl.sc/bW7VqVx
>
> We have started a thread in the above forum but have not been able to
> resolve the issue.
>
> You can refer to the URL for more details, but when I specify multiple
> sorting conditions based on the value of a custom field, the results are
> not displayed properly, and when I throw the query portion of the request
> in $query directly to SQL in the hook point of pre_get_posts, the
> following error is returned The following error is returned.
>

> {{{
> Expression #1 of ORDER BY clause is not in GROUP BY clause and contains
> non-aggregated column 'local.wp_postmeta.meta_value' which is not
> functionally dependent on columns in the GROUP BY clause; this is
> incompatible with sql_mode=only_full_group_by
> }}}
>
> {{{
>
> }}}
>

> Is this part of a bug?

New description:

 https://ja.wordpress.org/support/topic/pre_get_posts%e3%81%a7%e8%a4%87%e6%95%b0%e3%81%ae%e4%b8%a6%e3%81%b3%e9%a0%86%e6%8c%87%e5%ae%9a%e3%81%a7%e3%82%a8%e3%83%a9%e3%83%bc/#post-11682395

 We have started a thread in the above forum but have not been able to
 resolve the issue.

 You can refer to the URL for more details, but when I specify multiple
 sorting conditions based on the value of a custom field, the results are
 not displayed properly, and when I throw the query portion of the request
 in $query directly to SQL in the hook point of pre_get_posts, the
 following error is returned The following error is returned.


 {{{
 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains
 non-aggregated column 'local.wp_postmeta.meta_value' which is not
 functionally dependent on columns in the GROUP BY clause; this is
 incompatible with sql_mode=only_full_group_by
 }}}

 {{{

 }}}


 Is this part of a bug?

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57767#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list