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

Search doesn't work on Postgresql #372

Closed
hadolen opened this issue Jul 1, 2015 · 5 comments
Closed

Search doesn't work on Postgresql #372

hadolen opened this issue Jul 1, 2015 · 5 comments
Labels

Comments

@hadolen
Copy link

hadolen commented Jul 1, 2015

Search doesn't work on Postgresql when search by string.

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT COUNT(*) AS dctrn_count FROM (SELECT DISTINCT id0 FROM (SELECT p0_.id AS id0, p0_.title AS title1, p0_.description AS description2 FROM place p0_ WHERE p0_.id IN (?) OR p0_.title LIKE ? OR p0_.description LIKE ?) dctrn_result) dctrn_table' with params ["Good", "%Good%", "%Good%"]:

SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "Good"") in @EasyAdmin/default/list.html.twig at line 18.

@Pierstoval
Copy link
Contributor

I thought it was fixed some time ago and we decided to make searches only on text and string fields? /cc @javiereguiluz @ogizanagi

The issue comes from the fact that, with PostgreSQL you cannot make a field comparison with datas with different types. And right now, it checks that place.id is in ["Good", "%Good%", "%Good%"] , thus place.id is an integer and every datas in the array are string, so the DBMS does not allow this.

@javiereguiluz
Copy link
Collaborator

Given this query:

[...] WHERE p0_.id IN (?) OR p0_.title LIKE ? OR p0_.description LIKE ? ...
with params ["Good", "%Good%", "%Good%"]

I interpret it as follows:

[...] WHERE p0_.id IN ("Good") OR p0_.title LIKE "%Good%" OR p0_.description LIKE "%Good%"

That's why I don't understand your comment @Pierstoval: id field seems to be using the right non-text comparison.

@Pierstoval
Copy link
Contributor

In this query:

[...] WHERE p0_.id IN ("Good") OR p0_.title LIKE "%Good%" OR p0_.description LIKE "%Good%"

It seems that p0_.id's definition is INT whereas IN ("Good") compares it with a string.

@javiereguiluz
Copy link
Collaborator

@Pierstoval I understand your comment now. Sorry for that. I'm looking into this.

@javiereguiluz
Copy link
Collaborator

I'm trying to fix this bug in #381. Please review the proposed changes. Thanks!

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

Successfully merging a pull request may close this issue.

3 participants