Fix CTE scope bug: use temp table for cursor iteration
CTEs are only accessible within their WITH statement, but the FOR loop was outside that scope. This caused 'relation votes_to_process does not exist'. Solution: Use a data-modifying CTE to INSERT votes into a pre-created temp table, then iterate over the temp table in the FOR loop.
Loading
Please sign in to comment