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

Error in query: ER_BAD_FIELD_ERROR #1

Closed
kamil-malinski opened this issue May 20, 2022 · 5 comments
Closed

Error in query: ER_BAD_FIELD_ERROR #1

kamil-malinski opened this issue May 20, 2022 · 5 comments

Comments

@kamil-malinski
Copy link

Hi!

I added the interface to a m2m-field and get the following error in the console:

request errored GET 500 /items/tag?limit=10&fields[]=id&fields[]=name&filter=%7B%22_and%22:[%7B%7D,false,%7B%22name%22:%7B%22_contains%22:%22test1%22%7D%7D]%7D&sort=-id 74ms

🚨 select `tag`.`id`, `tag`.`name` from `tag` where (`tag`.`_eq` = false and `tag`.`name` like '%test%') order by `tag`.`id` desc limit 10 - ER_BAD_FIELD_ERROR: Unknown column 'tag._eq' in 'where clause'

what is the "_eq"-field that the query is trying to filter for?

@kamil-malinski
Copy link
Author

it works when I define at least one filter... so it looks like the problem is the building of the query when there is no filter assigned to the field

@dimitrov-adrian
Copy link
Owner

This shouldn't be the case.

Could you provide more info, what is the directus version and db type.

@kamil-malinski
Copy link
Author

kamil-malinski commented May 20, 2022

Directus version: 9.10.0
DB-Type: MySQL

I think the problem is in https://github.com/dimitrov-adrian/directus-extension-tags-m2m-interface/blob/main/src/interface.vue at #273 if props.filter is not set

if props.filter is not set this is the request that is being generated:

/items/tag?limit=10&fields[]=id&fields[]=name&filter={"_and":[{},false,{"name":{"_contains":"test"}}]}&sort=-id

@dimitrov-adrian
Copy link
Owner

Yes indeed. Thanks for the catch

@kamil-malinski
Copy link
Author

thank you for the quick fix!

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

2 participants