permission denied for relation

permission denied for relation

Postby skarosg3 » Tue 18 Feb 2014 10:01

Hi all,
I have been trying to get a Visual basic connection to my postgres DB for days, till i finaly came acros your site. it seems to be working like a charm. At least it seems to be connected to the DB.

I try to run a select command, as seen on your documentation

Code: Select all
Dim myConn As PgSqlConnection = New PgSqlConnection()
        myConn.ConnectionString = "User Id=myId;Password=Password;Host=;Port=5432;Unicode=true;"
        Dim command As PgSqlCommand = myConn.CreateCommand()
        command.CommandText = "select col from table"
Using readers As PgSqlDataReader = command.ExecuteReader()
                While readers.Read()
                For i As Integer = 0 To readers.FieldCount - 1
                    TextBoxA.Text = readers.GetValue(i).ToString() & vbNewLine
            End While
        End Using

and i am getting an error on
readers As PgSqlDataReader = command.ExecuteReader()
The error is
permission denied for relation table

The postgres isntallation is on a lan computer, and i think i did everything ok. To be honest its the first postgres lan installation i did, but i assume everything is set up.

Do you have any idea what might be the problem?
Posts: 7
Joined: Tue 18 Feb 2014 09:53

Re: permission denied for relation

Postby Pinturiccio » Thu 20 Feb 2014 12:31

The exception "permission denied for relation table" is a PostgreSQL exception. This exception can be reproduced with pgAdmin too. This exception means that the 'myId' user does not have priviledges for performing SELECT from the table 'table'.

If you want to perform the query:
Code: Select all
select col from table

You need to grant the required privileges to the 'myId' user. For more information, please refer to
Devart Team
Posts: 1982
Joined: Wed 02 Nov 2011 09:44

Return to dotConnect for PostgreSQL