colpivot
colpivot copied to clipboard
Better column names
Column names are hard to query , e.g. "'column_name'"
so here is how I sanitize them instead:
- get rid of any quotation mark, simple or double.
- substitue any non-alphanumeric character with a
_
- prefix the column name with a
_
if it starts with a numeric character
Sorry for the formatting, my PG-SQL is too rusty for something better.
@TristeFigure is there any other way of removing the single quotes from the column names?