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

Applying join and group by on list query results in duplicate column error #5373

Closed
YosraHamza opened this issue Nov 16, 2023 · 2 comments
Closed
Labels

Comments

@YosraHamza
Copy link

YosraHamza commented Nov 16, 2023

Bug report

What I did

Applying join and group by clauses on list action

What I expected to happen

I expected the list counts to work normally

What happened

An error ocurrend SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'id'

What I've already tried to fix it

Disabling list counts fixes the issue.
Enabling it will trigger the issue, the root cause is from the file
vendor/backpack/crud/src/app/Library/CrudPanel/Traits/Query.php at line 261, as in case of group by all the results are selected "*"

 $minimumColumns = ($crudQuery->groups || $crudQuery->havings) ? '*' : $modelTable.'.'.$this->model->getKeyName();

I checked Backpack 6 and this line was updated and is working in this case.

Is it a bug in the latest version of Backpack?

After I run composer update backpack/crud the bug... is it still there?
Yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:
backpack/crud: 5.6.1
backpack/generators: v3.3.17
backpack/logmanager: v4.0.11
backpack/pro: 1.6.6
backpack/settings: 3.1.0

PHP 8.1.18 (cli)
Mysql 8

Copy link

welcome bot commented Nov 16, 2023

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication channels:

  • Bug Reports, Feature Requests - Github Issues (here);
  • Quick help (How do I do X) - Gitter Chatroom;
  • Long questions (I have done X and Y and it won't do Z wtf) - Stackoverflow, using the backpack-for-laravel tag;
  • Showing off something you've made, asking for opinion on Backpack/Laravel matters - Reddit;

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

--
Justin Case
The Backpack Robot

@jcastroa87
Copy link
Member

Hello @YosraHamza, we no longer provide support for Backpack 5, if you have already verified that this situation is resolved in version 6, our recommendation is that you update it.

Thanks.

P.D.: i will close this issue because we will not update Backpack v5, but you are free to re-open or create new is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

2 participants