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

Fix: QueryBuilder's TextConstraint for Postgres #15446

Merged

Conversation

Zanzofily
Copy link
Contributor

Description

When a table name or column name contains uppercase letters, both table name and column name gets wrapped between double quotes inside any TextContraint operator.

for example: Flight table name with code field name becomes "Flight.code" which results in column not found error. Instead, it should be "Flight".code, and if column name contains uppercase letters, it should be "Flight"."Code".

Example error: Undefined column: 7 ERROR: column "Flight.code" does not exist LINE 1: ...count(*) as aggregate from "Flight" where (lower("Flight.c... ^ (Connection: pgsql, SQL: select count(*) as aggregate from "Flight" where (lower("Flight.code"::text)::text like search_string%))

It might not be very common when it comes to Laravel naming conventions, but I encountered this issue while building a dashboard for an app that was initially developed with Next.js and prisma, where this naming convention is common.

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@Zanzofily Zanzofily changed the title fix: QueryBuilder's TextConstraint for Postgres Fix: QueryBuilder's TextConstraint for Postgres Jan 27, 2025
@danharrin danharrin added the bug Something isn't working label Jan 31, 2025
@danharrin danharrin added this to the v3 milestone Jan 31, 2025
@danharrin danharrin merged commit 9141746 into filamentphp:3.x Jan 31, 2025
1 check passed
@danharrin
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants