How to Fix PGSQL query failed

Steps to fix the error Pgsql query failed

If you receive the following error while trying to access a page using postgresql database credentials, you can follow the steps listed below to fix this.

Warning: pg_query() [function.pg-query]: Query failed: ERROR: permission denied for relation in /home/username/public_html/123.php 
Warning: pg_num_rows(): supplied argument is not a valid PostgreSQL result resource in /home/username/public_html/123.php

Step 1: Open the postgresql configuration file.

vi /var/lib/pgsql/data/pg_hba.conf

Scroll down and check for the following lines.

local all all md5
host all all md5

 Just change it as given below and save the file.

 local all all md5
 host all all password

Step 2: Restart Postgresql.

/etc/rc.d/init.d/postgresql restart


Leave a Reply

Your email address will not be published. Required fields are marked *