FIX: Use full column name to prevent ambiguous query (#29111)

This can happen when other plugins, for example discourse-rainbow, are
installed and add columns with same names.
This commit is contained in:
Bianca Nenciu 2024-10-07 19:33:07 +03:00 committed by GitHub
parent d3793f7aea
commit 50cb7b897e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -240,11 +240,11 @@ class DiscoursePoll::Poll
SELECT poll_id, digest, rank, user_id
FROM (
SELECT pv.poll_id
, digest
, CASE rank WHEN 0 THEN 'Abstain' ELSE CAST(rank AS text) END AS rank
, user_id
, username
, ROW_NUMBER() OVER (PARTITION BY poll_option_id ORDER BY pv.created_at) AS row
, po.digest
, CASE pv.rank WHEN 0 THEN 'Abstain' ELSE CAST(pv.rank AS text) END AS rank
, pv.user_id
, u.username
, ROW_NUMBER() OVER (PARTITION BY pv.poll_option_id ORDER BY pv.created_at) AS row
FROM poll_votes pv
JOIN poll_options po ON pv.poll_id = po.poll_id AND pv.poll_option_id = po.id
JOIN users u ON pv.user_id = u.id