hg628193hg
hg628193hg

Reputation: 495

SQL Error [42883]: ERROR: function percentile_agg(double precision) does not exist for timescaleDB

i’m following this https://docs.timescale.com/timescaledb/latest/tutorials/nfl-analytics/advanced-analysis/#average-and-median-yards-run-per-game-by-type-of-player , for this sql, i got the error:

WITH sum_yards AS (
 SELECT a.player_id, displayname, SUM(yards) AS yards, gameid
 FROM player_yards_by_game a
 LEFT JOIN player p ON a.player_id = p.player_id
 GROUP BY a.player_id, displayname, gameid
)
SELECT player_id, displayname, mean(percentile_agg(yards)) as yards
FROM sum_yards
GROUP BY player_id, displayname
ORDER BY yards DESC

SQL Error [42883]: ERROR: function percentile_agg(double precision) does not exist Hint: No function matches the given name and argument types. You might need to add explicit type casts. Position: 246

I have followed the tutorial this far without any error... but this error suddenly pop out... Anyone helps? thanks!

Upvotes: 1

Views: 1516

Answers (2)

Greg
Greg

Reputation: 2609

When I run CREATE EXTENSION timescaledb_toolkit; the result isERROR: could not access file "MODULE_PATHNAME": No such file or directory. I just reinstalled or confirmed install following the instructions for installing with the Postgres.app on Apple Silicon

Upvotes: 1

davidk
davidk

Reputation: 1053

Most likely you don't have the TimescaleDB Toolkit extension installed, https://docs.timescale.com/timescaledb/latest/how-to-guides/install-timescaledb-toolkit/. Depending on how you're running Timescale, it may be just as easy as CREATE EXTENSION timescaledb_toolkit; Otherwise, you may need to build the extension and install via the instructions here: https://github.com/timescale/timescaledb-toolkit/blob/main/Readme.md

Upvotes: 1

Related Questions