I'm using PostgreSQL 9.2.
Is there any way to get an output like,
Database : mydb, User : myUser
using a SELECT query?
By using the inbuilt System Information Functions
1.) Currently using database
select current_database()
2.) Connected User
select user
To get the desired output use either this
select 'Database : ' ||current_database()||', '||'User : '|| user db_details
or
select format('Database: %s, User: %s',current_database(),user) db_details
Check this part of the manual for more functions.
SELECT current_user,
user,
session_user,
current_database(),
current_catalog,
version();