Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/admin/changes: ErrorException: SQLSTATE[42000]: Syntax error or access violation: 1055 #34

Closed
eminos opened this issue Apr 12, 2017 · 10 comments

Comments

@eminos
Copy link

eminos commented Apr 12, 2017

Page /admin/changes gives this error:

Method Bkwld\Decoy\Fields\Listing::__toString() must not throw an exception, caught ErrorException: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'opio.changes.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select changes.id, CONCAT(first_name, " ", last_name) name from changes inner join admins on admins.id = admin_id group by admin_id) (View: C:\Users\emin\Dev\opio\vendor\bkwld\decoy\views\shared\list_full_header.haml)

Laravel 5.4

@weotch
Copy link
Member

weotch commented Apr 12, 2017

What database and version are you using?

@eminos
Copy link
Author

eminos commented Apr 12, 2017

mysql 5.7

@weotch
Copy link
Member

weotch commented Apr 12, 2017

From https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html

The ONLY_FULL_GROUP_BY and STRICT_TRANS_TABLES modes were added in MySQL 5.7.5.

We're running 5.6 here, which is why we haven't encountered this.


I added a commit to master, can you see if dev-master fixes it for you?

@eminos
Copy link
Author

eminos commented Apr 12, 2017

Yea, that solved it. Thanks :)

@noxify
Copy link
Contributor

noxify commented Apr 24, 2017

The same problem occurs with postgres (9.6.10) :)

@weotch
Copy link
Member

weotch commented Apr 24, 2017

@noxify Did the master branch fix? We're gonna tag a new release soon

@weotch weotch closed this as completed Apr 24, 2017
@noxify
Copy link
Contributor

noxify commented Apr 24, 2017

@weotch i used the "composer require ..." from the docs - I will change it and test it again.

Thanks for the hint :)

@noxify
Copy link
Contributor

noxify commented Apr 24, 2017

@weotch - tested it with postgres and mysql5.6, but with both databases I got the following error:

Method Bkwld\Decoy\Fields\Listing::__toString() must not throw an exception, caught ErrorException: SQLSTATE[42000]: Syntax error or access violation: 1055 'decoy.admins.id' isn't in GROUP BY (SQL: select admins.id, CONCAT(first_name, " ", last_name) name from `changes` inner join `admins` on `admins`.`id` = `admin_id` group by `admin_id`) (View: /Applications/MAMP/htdocs/decoy/vendor/bkwld/decoy/views/shared/list/_full_header.haml)
  • OSX
  • MAMP with PHP7.1
  • mysql 5.6
  • postgres 9.6.10

composer.json:

"require": {
        "php": ">=5.6.4",
        "bkwld/decoy": "dev-master",
        "laravel/framework": "5.4.*", //5.4.19
        "laravel/tinker": "~1.0"
    },

@noxify
Copy link
Contributor

noxify commented Apr 24, 2017

I changed the getAdmins() method to the following:

    public static function getAdmins()
    {
        return Admin::all(['id', 'email'])->pluck('email', 'id');
    }

and everything works fine :)

If i'm not wrong, the getAdmins() will be used to show the values for the search dropdown.
Does it not make sense to show all admins without the limitation?

@weotch
Copy link
Member

weotch commented Apr 25, 2017

@noxify Yeah, works for me, thanks for looking into it.

The issue is that only postgres doesn't use CONCAT

@weotch weotch reopened this Apr 25, 2017
weotch added a commit that referenced this issue Apr 25, 2017
It’s not available to SQLLite, this makes the databases a bit more portable
#34
weotch added a commit that referenced this issue Apr 25, 2017
@weotch weotch closed this as completed Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants