Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5751
  • Last Modified:

PostgreSQL ERROR: permission denied for relation

I am designing a website in PHP 5, HTML, CSS, etc using a PostgreSQL 8.1 database on the back-end.

I want to add a new record a new table (confirmemail) I've created in my PUBLIC schema using the "insert into" command.  I can add it from within the PostgreSQL EMS SQL Editor, however when I try to do the same thing through my PHP functions/classes, I keep getting the following error message:

Query failed: ERROR:  permission denied for relation confirmemail.

This is totally baffling me.  Yes, I've set the public grants onthe confirmemail table and I've checked over the table properties to look for any anomalies.  What's worse is that this behaviour seems to be happening to any new tables I add to the database.

Does anybody have any ideas or come across this?
0
qu3nt1n
Asked:
qu3nt1n
3 Solutions
 
hujiCommented:
First you need to make sure that you are using the same username and password that you use when you want to connect the database by SQL Editor, as what your PHP code is using in its database connect command. In case they are different, you should make sure that the account used by PHP has enough permissions to write into the database.

Second, you should try to create another table (with no relations to any other tables) and see if PHP can insert into it. If yes, then there is a relationship between the tables that is generating the problem.

After you did this, post relevant parts of the code here, with the new error messages you would have got.

Wish I can help
Huji
0
 
imsunnyCommented:
I would like to know the connection string you are using.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now