rainlab/blog-plugin

Posts list sql issue after update to OctoberCMS 3.1

LZaplata opened this issue · 1 comments

Hello,

I am getting this error after updating to last version of both plugin and OctoberCMS.

image

Thanks for finding this bug. It will be fixed in v3.1.1

Here is the query comparison

v3.1.0

order by nest_left asc in the subquery is illegal in this context.

select `rainlab_blog_posts`.*, 
    (select group_concat(name separator ', ')
        from `rainlab_blog_categories`
        inner join `rainlab_blog_posts_categories`
            on `rainlab_blog_categories`.`id` = `rainlab_blog_posts_categories`.`category_id`
        where `rainlab_blog_posts`.`id` = `rainlab_blog_posts_categories`.`post_id`
        order by `nest_left` asc
    ) as `categories`
from `rainlab_blog_posts`
order by `published_at` desc limit 25 offset 0  

v2.2

No order by subquery

select `rainlab_blog_posts`.*,
    (select group_concat(name separator ', ')
        from `rainlab_blog_categories`
        inner join `rainlab_blog_posts_categories`
            on `rainlab_blog_categories`.`id` = `rainlab_blog_posts_categories`.`category_id`
        where `rainlab_blog_posts`.`id` = `rainlab_blog_posts_categories`.`post_id`
    ) as `categories`
from `rainlab_blog_posts`
order by `published_at` desc limit 25 offset 0  

v3.1.1

No order by subquery

select `rainlab_blog_posts`.*,
    (select group_concat(name separator ', ')
        from `rainlab_blog_categories`
        inner join `rainlab_blog_posts_categories`
            on `rainlab_blog_categories`.`id` = `rainlab_blog_posts_categories`.`category_id`
        where `rainlab_blog_posts`.`id` = `rainlab_blog_posts_categories`.`post_id`
    ) as `categories`
from `rainlab_blog_posts`
order by `published_at` desc limit 25 offset 0