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

Not compatible with PostgreSQL? #48

Open
Marcuzz opened this issue Nov 18, 2024 · 0 comments
Open

Not compatible with PostgreSQL? #48

Marcuzz opened this issue Nov 18, 2024 · 0 comments

Comments

@Marcuzz
Copy link

Marcuzz commented Nov 18, 2024

Hi,

When using this plugin with PostgreSQL we seem to be encountering a lot of errors with several SQL queries. For example:

->where('relations.targetId=assets.id')
->orWhere('relations.sourceId=assets.id');

The columns in PostgreSQL are transformed to lowercase unless they are wrapped in double quotes, and PostgreSQL is case-sensitive. For these queries to work the column has to be wrapped in double quotes, i.e: relations."targetId"

There is another issue on the following lines as well:

->where("`content` LIKE CONCAT('%asset:', assets.id, ':%')")
->orWhere("`content` LIKE CONCAT('%\"imageId\": \"', assets.id, '\",%')");

There is a type incompatible comparison here. "LIKE" is only possible on text/strings, but "content" is a jsonb column.

There are more similar PostgreSQL errors, here:

->where(['like', 'content', "asset:{$asset->id}:"])
->orWhere(['like', 'content', "\"imageId\": \"{$asset->id}\","])

I'm not sure what the best way to fix this is, while keeping compatibility with MySQL as well, so I figured I'd just create an issue as opposed to a PR.

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

1 participant