Skip to content

Instantly share code, notes, and snippets.

@clouedoc
Created October 15, 2022 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clouedoc/2fa443e57cd4dd6e79b32409262d004d to your computer and use it in GitHub Desktop.
Save clouedoc/2fa443e57cd4dd6e79b32409262d004d to your computer and use it in GitHub Desktop.
Pq: function time_bucket(unknown, timestamp without time zone) does not exist

Weird TimescaleDB permission error

Hello there,

I've encountered this error while trying to add a TimescaleDB (Postgres) datasource to Postgres:

Pq: function time_bucket(unknown, timestamp without time zone) does not exist

There is no solution online, so I've decided to post mine here. I hope that it finds you well

Solution

The solution is to recreate a new user. Then, you can grant the following permissions:

CREATE USER grafana_datasource WITH LOGIN PASSWORD 'your_supersecret_password';

GRANT SELECT ON ALL TABLES IN SCHEMA public TO grafana_datasource;
GRANT USAGE ON SCHEMA public TO grafana_datasource;

-- I am not sure if the two below are really necessary, so feel free to try without it and leave a comment for others
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO grafana_datasource;
GRANT EXECUTE ON ALL PROCEDURES IN SCHEMA public TO grafana_datasource;

Contribute too!

The next time that you find an undocumented error online, don't hesitate to post it as a private gist. This is a passive karma income idea that you can start today! (make sure to publish your gist as public or it won't get picked up by Google)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment