yajra / laravel-datatables

jQuery DataTables API for Laravel
https://yajrabox.com/docs/laravel-datatables
MIT License
4.76k stars 858 forks source link

Error SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "as" #871

Closed Abdulhmid closed 7 years ago

Abdulhmid commented 7 years ago

Summary of problem or feature request

Code snippet of problem

System details

efriandika commented 7 years ago

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)
yajra commented 7 years ago

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.

yajra commented 7 years ago

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