How to give title to the result of a select query in postgresql? For example I want to do like this:  

select id,name from first;  


It should look like this:  

The Query Result // this should be the title of the query  
id name  
1  Ali  
2  Sami
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)