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

Postgres: Filtering on select and text with hasMany:true not working #5153

Closed
Janisvb opened this issue Feb 22, 2024 · 1 comment
Closed
Assignees
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@Janisvb
Copy link

Janisvb commented Feb 22, 2024

Link to reproduction

https://github.com/Janisvb/payload-reproduction/tree/filtering

Describe the Bug

Filtering on a select- or text-field with hasMany:true is not working with Postgres.

To Reproduce

yarn dev:postgres _community

  1. Equals filter on select-field with hasMany: false (correct)
    http://localhost:3000/api/posts?where[type][equals]=post

  2. Equals-filter on select-field or text-field with hasMany: true (error)
    http://localhost:3000/api/posts?where[categories][equals]=ts or http://localhost:3000/api/posts?where[categories_text][equals]=ts
    ERROR (payload): error: syntax error at or near "="

  3. In-filter on select-field or text-field with hasMany: true (error)
    http://localhost:3000/api/posts?where[categories][in]=js,ts or http://localhost:3000/api/posts?where[categories_text][in]=js,ts
    ERROR (payload): error: syntax error at or near "in"

  4. All-filter on select-field or text-field with hasMany: true (not supported)
    http://localhost:3000/api/posts?where[categories][all]=js,ts or http://localhost:3000/api/posts?where[categories_text][all]=js,ts
    ERROR (payload): TypeError: _operatorMap.operatorMap[queryOperator] is not a function

It is working as expected with MongoDB.

Payload Version

2.11.1

Adapters and Plugins

db-postgres

@Janisvb Janisvb added the status: needs-triage Possible bug which hasn't been reproduced yet label Feb 22, 2024
@PatrikKozak PatrikKozak self-assigned this Apr 18, 2024
@PatrikKozak
Copy link
Contributor

Hey @Janisvb - thanks for reporting this! The above has been fixed with these two PRs:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

2 participants