How to give title to the result of a select query in postgresql?
If you use psql, you can change the field separator using \f and \a meta commands. I show an example below:


testdb=# SELECT * FROM first;
 id | name 
----+------
  1 | Ali
  2 | Sami
(2 rows)

testdb=# \f ','
Field separator is ",".

testdb=# \a
Output format is unaligned.

testdb=# SELECT * FROM first;
id,name
1,Ali
2,Sami
(2 rows)


And, \C meta command can be added any titles.


testdb=# \C 'The Query Result'
Title is "The Query Result".

testdb=# SELECT * FROM first;
The Query Result
id,name
1,Ali
2,Sami
(2 rows)