colpivot
colpivot copied to clipboard
Mixed-case columns
It would be good to include a note in the README about mixed-case columns.
The code does double-quote column names, so mixed-case columns can be used.
However, there are two cases where the user has to do the quoting themselves.
- value_e
- col_order
Example cross-tabulating grading results by lesson:
SELECT colpivot(
'_test_pivoted',
'select * FROM n_correct_for_course_by_lesson_s(''ANON'')',
array['userCode'],
array['lessonCode'],
'#."percentCorrect"',
'MAX("lessonOrder")' -- bizarre syntactical requirement
);
select * from _test_pivoted ORDER BY "userCode";