'Postgressql - Transpose Rows to Columns

i have table like this

reg_number Operator
00001 aa
00001 bb
00002 aa
00002 bb
00002 dd
00003 aa
00003 bb
00003 cc
00003 dd
etc.

this is output i want

reg_number op1 op2 op3 op4
00001 aa bb NULL NULL
00002 aa bb NULL dd
00003 aa bb cc dd


Solution 1:[1]

Looks like there is a problem in psych gem, specifically in the safe_load method that got some breaking changes. Windows is not the problem here.

It was discussed in these questions: here and there and in the issue.

Until issue is not fixed I'd suggest to manually set the version of psych to older 3.3.2 in Gemfile.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pavel Oganesyan