4

I recently ran into this error message and am posting an answer here so that the solution is easily searchable in the future.

Problem: The following query returns an error message when run on Amazon Redshift. What does it mean and does Amazon Redshift support the 'median' aggregate?

dev=# select median(5);
ERROR: cache lookup failed for aggregate 2762
asked Dec 18, 2014 at 17:37

1 Answer 1

3

Amazon recently added support for the 'median' window function. If you forget that it's only a window function and try to use it like an aggregate, you'll get this error:

dev=# select median(5);
ERROR: cache lookup failed for aggregate 2762

The solution is to rephrase the query to use it as a window function:

dev=# select median(5) over ();
 median 
--------
 5

(1 row)

answered Dec 18, 2014 at 17:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.