Tuesday, April 26, 2016

Postgresql: pg_indent.conf privilege issue.

Issue happening in porting postgresql database to newly setup database. By default, the database will be ported but will not have direct access to the database with it's assigned user, in this case 'vc'. Upon doing  \dt or select on the the table, it would say relation not found. However, performing a global search on newly ported database, tables will show to exist in designated schema.


SELECT table_schema,table_name
FROM information_schema.tables
where table_schema not in ('pg_catalog','information_schema')
ORDER BY table_schema,table_name;



-bash-4.1$ psql -U vc -d vcdb
psql: FATAL:  Peer authentication failed for user "vc"


edit pg_hba.conf

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
#local   all             all                                     peer
local   all             all                                     trust
-bash-4.1$ /usr/pgsql-9.2/bin/pg_ctl  -p 5432 -D /var/lib/pgsql/9.2/data reload
server signaled


########################
Another scenario
########################


vcdb=# SELECT * FROM VC.VERSION;
ERROR:  relation "vc.version" does not exist
LINE 1: SELECT * FROM VC.VERSION;

vcdb=# \c vcdb vc
FATAL:  Peer authentication failed for user "vc"
Previous connection kept


vcdb=# select count(*) from vc.vpx_version;
 count
-------
     1
(1 row)


<< change pg_ident.conf then reload >>

vcdb=# select pg_reload_conf();
 pg_reload_conf
----------------
 t
(1 row)


vcdb=# \c vcdb vc
psql (9.3.5, server 9.2.9)
You are now connected to database "vcdb" as user "vc".
vcdb=>

No comments:

Post a Comment