Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psycopg2.errors.InsufficientPrivilege error when using an installation from github #303

Closed
adityabaradwaj opened this issue Aug 25, 2022 · 5 comments
Assignees
Labels

Comments

@adityabaradwaj
Copy link

adityabaradwaj commented Aug 25, 2022

Steps to reproduce:

  1. Follow the "Installation from the git repository" steps in the README:
$ git clone https://github.com/dalibo/pg_activity.git
$ cd pg_activity
$ python3 -m venv .venv
$ . .venv/bin/activate
(.venv) $ pip install psycopg2-binary .
(.venv) $ pg_activity
  1. Run sudo $(which pg_activity) --rds [connection_string]
    where connection_string is of the format postgresql://[user[:password]@][netloc][:port][/dbname]

Expected result: connects to the postgres RDS database
Actual result:

Traceback (most recent call last):
  File "/home/ubuntu/pg_activity/.venv/bin/pg_activity", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/pg_activity/.venv/lib/python3.7/site-packages/pgactivity/cli.py", line 347, in main
    ui.main(term, dataobj, host, args)
  File "/home/ubuntu/pg_activity/.venv/lib/python3.7/site-packages/pgactivity/ui.py", line 32, in main
    skip_sizes=options.nodbsize,
  File "/home/ubuntu/pg_activity/.venv/lib/python3.7/site-packages/pgactivity/data.py", line 231, in pg_get_server_information
    "using_rds": using_rds,
  File "/home/ubuntu/pg_activity/.venv/lib/python3.7/site-packages/psycopg2/extras.py", line 146, in execute
    return super().execute(query, vars)
psycopg2.errors.InsufficientPrivilege: permission denied for function pg_ls_dir

Note: this issue does not happen when using the pg_activity installed from the postgresql APT repo: sudo pg_activity --rds postgresql://[user[:password]@][netloc][:port][/dbname]

The reason I need to install from git is because I am facing this bug (I am able to connect to the db, but the connection drops after about 10 seconds due to the exception psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type bytea)

It looks like that bug was fixed in May, so I'm assuming the fix didn't get included in the April release of 2.3.1

@blogh
Copy link
Collaborator

blogh commented Sep 1, 2022

Hi,

Sorry for the delayed answer.
Thanks for reporting this. I have a patch in progress to Fix all theses privileges issues.

@blogh blogh self-assigned this Sep 1, 2022
@blogh blogh added the bug label Sep 1, 2022
@blogh
Copy link
Collaborator

blogh commented Sep 1, 2022

It should be out soon..ish.

@blogh
Copy link
Collaborator

blogh commented Sep 5, 2022

Hi,

Master should fix your problem. The tempfile check is disabled if it fails or if you add --no-tempfiles or --rds.

@blogh
Copy link
Collaborator

blogh commented Sep 5, 2022

Feel free to reopen if not.

@blogh blogh closed this as completed Sep 5, 2022
@adityabaradwaj
Copy link
Author

Works now, thanks!

blogh added a commit to blogh/pg_activity that referenced this issue Sep 16, 2022
Breaking change:

* Attr 18.1 is required

Change log:

* Add more information to the header (instance and process stats) (Tests
  by @Krysztophe)
* Add the --refresh option to the cli to set the refresh rate (dalibo#293)
  (Requested by @crysman)
* Add the --debug-file option to enable logging (still mostly unused)
* Add hints about runtime disabled features (dalibo#300) (Reported by @rutchkiwi)
* The SUPERUSER privilege is not longer required (dalibo#277) (Requested by
  @Raymondmax)

Bug fixes:

* Add the --no-walreceiver to disable wal receiver stats for Aurora
  (dalibo#301) (Reported by @grutz)
* Add the --no-tempfiles option to disable temp file statistics and
  add it to the --rds command (dalibo#303) (Reported by @adityabaradwaj)
* Fix server information queries for v12/v13 (Reported and fixed by
  @kmoppel-cognite)
* Fix InvalidTextRepresentation errors (dalibo#275) (Fix proposed by
  @ssharunas)
* Fix sort order for parallel queries (dalibo#297) (Reported and fixed by
  @kmoppel-cognite)
* Doc fixes and packaging improvements (@kianmeng, @Vampouille)
@blogh blogh mentioned this issue Sep 16, 2022
blogh added a commit that referenced this issue Sep 16, 2022
Breaking change:

* Attr 18.1 is required

Change log:

* Add more information to the header (instance and process stats) (Tests
  by @Krysztophe)
* Add the --refresh option to the cli to set the refresh rate (#293)
  (Requested by @crysman)
* Add the --debug-file option to enable logging (still mostly unused)
* Add hints about runtime disabled features (#300) (Reported by @rutchkiwi)
* The SUPERUSER privilege is not longer required (#277) (Requested by
  @Raymondmax)

Bug fixes:

* Add the --no-walreceiver to disable wal receiver stats for Aurora
  (#301) (Reported by @grutz)
* Add the --no-tempfiles option to disable temp file statistics and
  add it to the --rds command (#303) (Reported by @adityabaradwaj)
* Fix server information queries for v12/v13 (Reported and fixed by
  @kmoppel-cognite)
* Fix InvalidTextRepresentation errors (#275) (Fix proposed by
  @ssharunas)
* Fix sort order for parallel queries (#297) (Reported and fixed by
  @kmoppel-cognite)
* Doc fixes and packaging improvements (@kianmeng, @Vampouille)
blogh added a commit to blogh/pg_activity that referenced this issue Sep 16, 2022
Breaking change:

* Attr 18.1 is required

Change log:

* Add more information to the header (instance and process stats) (Tests
  by @Krysztophe)
* Add the --refresh option to the cli to set the refresh rate (dalibo#293)
  (Requested by @crysman)
* Add the --debug-file option to enable logging (still mostly unused)
* Add hints about runtime disabled features (dalibo#300) (Reported by @rutchkiwi)
* The SUPERUSER privilege is not longer required (dalibo#277) (Requested by
  @Raymondmax)

Bug fixes:

* Add the --no-walreceiver to disable wal receiver stats for Aurora
  (dalibo#301) (Reported by @grutz)
* Add the --no-tempfiles option to disable temp file statistics and
  add it to the --rds command (dalibo#303) (Reported by @adityabaradwaj)
* Fix server information queries for v12/v13 (Reported and fixed by
  @kmoppel-cognite)
* Fix InvalidTextRepresentation errors (dalibo#275) (Fix proposed by
  @ssharunas)
* Fix sort order for parallel queries (dalibo#297) (Reported and fixed by
  @kmoppel-cognite)
* Doc fixes and packaging improvements (@kianmeng, @Vampouille)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants