A key value pair(column name, value) needs to be retrieved from a table with about hundred columns.
The following query does exactly what is needed.
With dummy AS (
Select 1 as Col1, 2 as Col2
)
SELECT
unnest(array['Col1', 'Col2']) AS "Column Name",
unnest(array[Col1, Col2]) AS "Value"
FROM dummy
But, it requires to specify the columns explicitly.
Is there a way to generate the same output by not specifying the column names directly at all or generate it dynamically.