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 referencing relations.sourceId #2

Open
ieuan opened this issue May 14, 2024 · 0 comments
Open

Error referencing relations.sourceId #2

ieuan opened this issue May 14, 2024 · 0 comments

Comments

@ieuan
Copy link

ieuan commented May 14, 2024

I installed this plugin and activated restriction on one section with Restrict All setting selected.
When trying to load that page in the control panel there is a server error:

"SQLSTATE[42703]: Undefined column: 7 ERROR: column relations.sourceid does not exist\nLINE 3: LEFT JOIN "elements" ON elements.id = relations.sourceId\n ^\nHINT: Perhaps you meant to reference the column "relations.sourceId".\nThe SQL being executed was: SELECT EXISTS(SELECT "relations"."id"\nFROM "relations"\nLEFT JOIN "elements" ON elements.id = relations.sourceId\nWHERE "targetId"=42446)"

Trace puts the error on Line 129 of Restrict.php which is the query in side isRelated function.

Screenshot 2024-05-14 at 09 57 10

I changed the leftJoin comparison string to this:
->leftJoin('{{%elements}}', 'elements.id = "relations"."sourceId"')
which resolved the issue.

CraftCMS: 4.8.11
Postgres: 15

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