mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +08:00
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:
@ -240,11 +240,11 @@ class DiscoursePoll::Poll
|
|||||||
SELECT poll_id, digest, rank, user_id
|
SELECT poll_id, digest, rank, user_id
|
||||||
FROM (
|
FROM (
|
||||||
SELECT pv.poll_id
|
SELECT pv.poll_id
|
||||||
, digest
|
, po.digest
|
||||||
, CASE rank WHEN 0 THEN 'Abstain' ELSE CAST(rank AS text) END AS rank
|
, CASE pv.rank WHEN 0 THEN 'Abstain' ELSE CAST(pv.rank AS text) END AS rank
|
||||||
, user_id
|
, pv.user_id
|
||||||
, username
|
, u.username
|
||||||
, ROW_NUMBER() OVER (PARTITION BY poll_option_id ORDER BY pv.created_at) AS row
|
, ROW_NUMBER() OVER (PARTITION BY pv.poll_option_id ORDER BY pv.created_at) AS row
|
||||||
FROM poll_votes pv
|
FROM poll_votes pv
|
||||||
JOIN poll_options po ON pv.poll_id = po.poll_id AND pv.poll_option_id = po.id
|
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
|
JOIN users u ON pv.user_id = u.id
|
||||||
|
Reference in New Issue
Block a user