D
D
Dmitry Filyushin2016-01-08 07:15:25
Python
Dmitry Filyushin, 2016-01-08 07:15:25

Why is the permissions request not being fulfilled?

Executing a script with psycopg2 connected

import psycopg2
self.conn = psycopg2.connect(_conn_string)
self.cursor = self.conn.cursor()
self.cursor.execute('GRANT SELECT, INSERT ON TABLE log_fields TO manager;')

gives the error "ERROR: current transaction aborted, commands until the end of the transaction block are ignored"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nirvimel, 2016-01-08
@Filyushin

You can find out the details of the error, for example, like this:

try:
    self.cursor.execute('GRANT SELECT, INSERT ON TABLE log_fields TO manager;')
except psycopg2.Error as e:
    print(e.pgerror)
    print(e.diag.message_primary)
    print(psycopg2.errorcodes.lookup(e.pgcode))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question