is it possible to retreive the value of a column AND the descirption of each column? I want to see the description behind wach value.
SELECT a.*, (SELECT d.description FROM information_schema.COLUMNS AS c LEFT JOIN pg_description as d ON d.objsubid = c.ordinal_position WHERE TABLE_NAME = <a.tablename> AND column_name = <colname>) as description FROM table as a WHERE true;
The table should by look like this:
id: serial 'no description'; col1: int2 'Column One'; col2: int2 'Column Two';
1, 10, 11 2, 20, 21 3, 30, 31
The result should look like this:
1, 10 (column one), 11 (column two) 2, 20 (column one), 21 (column two) 3, 30 (column one), 31 (column two)