Laravel-datatables: Error SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "as"

Created on 2 Dec 2016  ·  3Comments  ·  Source: yajra/laravel-datatables

Summary of problem or feature request

Code snippet of problem

System details

  • Operating System
  • PHP Version
  • Laravel Version
  • Laravel-Datatables Version
bug

Most helpful comment

Thanks for reporting. I think this might be connected to PR #849. I haven't used PostgreSQL so if someone can please submit a PR for a possible fix? Will try to setup a postrgeSQL app when I had the chance. Sorry for the inconvenience.

All 3 comments

I got same error

DB: PostgreSQL. It worked when I still used v6.22.0. It will not work in > v6.22.0

QueryException in Connection.php line 729: 

SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "as"
LINE 1: ...st"."created_by" where (LOWER("post"."CAST(title" as "TEXT)"...
^ (SQL: select count(*) as aggregate from (select row_number() OVER (ORDER BY publish_date_start DESC) AS rownum, "post".*, "post_category"."name" as "category_name", "post_channel"."name" as "channel_name", "users"."name" from "post" inner join "post_category" on "post_category"."id" = "post"."post_category_id" inner join "post_channel" on "post_channel"."id" = "post_category"."post_channel_id" inner join "users" on "users"."id" = "post"."created_by" where (LOWER("post"."CAST(title" as "TEXT)") LIKE %b% or LOWER("CAST(users"."name" as "TEXT)") LIKE %b%) and "post"."deleted_at" is null and "post"."deleted_at" is null order by "publish_date_start" desc) count_row_table)

Thanks for reporting. I think this might be connected to PR #849. I haven't used PostgreSQL so if someone can please submit a PR for a possible fix? Will try to setup a postrgeSQL app when I had the chance. Sorry for the inconvenience.

Guys, can you please check if the PR above fixes this issue? Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NidhiDesai11 picture NidhiDesai11  ·  3Comments

alejandri picture alejandri  ·  3Comments

t0n1zz picture t0n1zz  ·  3Comments

sangnguyenplus picture sangnguyenplus  ·  3Comments

hohuuhau picture hohuuhau  ·  3Comments