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

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

我正在关注这个 https://docs.timescale.com/timescaledb/latest/tutorials/nfl-analytics/advanced-analysis/#average-and-median-yards-run-per-game-by-type-of-player,对于这个 sql,我得到了错误:

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

我按照教程到目前为止没有任何错误...但是这个错误突然弹出...有人帮忙吗?谢谢!

很可能您没有安装 TimescaleDB 工具包扩展,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