Sometimes, you need to set one of the Postgres configuration items for just one user or just one database.  This is easy to do in Postgres.  Note: I’m using the ‘log_’ configuration parameters here, but, there are many items you can set per user / db:

For an exhausitve list, run the query: 

select name, context from pg_settings where context = 'user';
postgres=# alter user postgres set log_  [tab][tab]
log_duration                log_min_duration_statement  log_planner_stats
log_error_verbosity         log_min_error_statement     log_statement
log_executor_stats          log_min_messages            log_statement_stats
log_lock_waits              log_parser_stats            log_temp_files

This will ensure that any time that user logs in, it sets that variable in the session appropriately.  Same for the database:

postgres=# alter database postgres set  log_
log_duration                log_min_duration_statement  log_planner_stats
log_error_verbosity         log_min_error_statement     log_statement
log_executor_stats          log_min_messages            log_statement_stats
log_lock_waits              log_parser_stats            log_temp_files

example:

Log ALL sql queries, issued by the ‘postgres’ user.

ALTER USER postgres SET log_min_duration_statement=0;

Remove the config

ALTER USER postgres RESET log_min_duration_statement; 

To view per-user settings:

postgres=# select * from pg_user;
 usename  | usesysid | usecreatedb | usesuper | usecatupd | userepl |  passwd  | valuntil |           useconfig
----------+----------+-------------+----------+-----------+---------+----------+----------+--------------------------------
 postgres |    24878 | f           | t        | t         | f       | ******** |          | {log_min_duration_statement=0}
 scottm   |       10 | t           | t        | t         | t       | ******** |          |
(2 rows)

To view per-database settings 

( this command shows you info for roles as well, and is more compact, but, I wanted you to see the underlying table for per-user settings as well.)

postgres=# \drds
                 List of settings
   Role   | Database |           Settings
----------+----------+------------------------------
 postgres |          | log_min_duration_statement=0
          | my_test  | log_min_duration_statement=0

If you wanted to generate this from a query, you would use: 

SELECT rolname AS "Role", datname AS "Database",
pg_catalog.array_to_string(setconfig, E'\n') AS "Settings"
FROM pg_db_role_setting AS s
LEFT JOIN pg_database ON pg_database.oid = setdatabase
LEFT JOIN pg_roles ON pg_roles.oid = setrole
ORDER BY 1, 2;