-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: internal error: indexed var must be bound to a container before evaluation #38286
Comments
Ping. Can you take a look at this again? |
Thanks, yes, I'll take a look. |
Ping. |
I pinged Justin, and he responded with "Sorry, the thing I thought would be the easy solution won't work I think, so I need to find some time to dig in and figure out what needs to happen here." I'll assign him to look into this issue since I'm lacking the context of optimizer to fix this properly. |
Oh oh, the reducer worked really well for this:
|
ping @justinj This is the only pending sqlsmith bug. |
plong |
Sorry, will get to it—have some other stuff I've been working through that needs to get in, but I will come back to this. |
Fixes cockroachdb#38286. This is a departure from the behaviour of the heuristic planner but is actually the same behaviour as Postgres: ``` d=# create table x (a int primary key); CREATE TABLE d=# select rank() over (order by a range between a preceding and unbounded following) from x; ERROR: argument of RANGE must not contain variables LINE 1: select rank() over (order by a range between a preceding and... ``` Our behaviour now: ``` root@127.0.0.1:60679/movr> CREATE TABLE x (a INT8 PRIMARY KEY) CREATE TABLE root@127.0.0.1:60679/movr> SELECT rank() OVER (ORDER BY a RANGE BETWEEN a PRECEDING AND UNBOUNDED FOLLOWING) FROM x pq: ROWS or RANGE cannot contain variables ``` Release justification: Category 2: Fixes a bug and brings behaviour more in-line with Postgres. Release note (sql change): column references are no longer allowed in ROWS/RANGE clauses in window functions.
Fixes cockroachdb#38286. This is a departure from the behaviour of the heuristic planner but is actually the same behaviour as Postgres: ``` d=# create table x (a int primary key); CREATE TABLE d=# select rank() over (order by a range between a preceding and unbounded following) from x; ERROR: argument of RANGE must not contain variables LINE 1: select rank() over (order by a range between a preceding and... ``` Our behaviour now: ``` root@127.0.0.1:60679/movr> CREATE TABLE x (a INT8 PRIMARY KEY) CREATE TABLE root@127.0.0.1:60679/movr> SELECT rank() OVER (ORDER BY a RANGE BETWEEN a PRECEDING AND UNBOUNDED FOLLOWING) FROM x pq: ROWS or RANGE cannot contain variables ``` Release justification: Category 2: Fixes a bug and brings behaviour more in-line with Postgres. Release note (sql change): column references are no longer allowed in ROWS/RANGE clauses in window functions.
Fixes cockroachdb#38286. This is a departure from the behaviour of the heuristic planner but is actually the same behaviour as Postgres: ``` d=# create table x (a int primary key); CREATE TABLE d=# select rank() over (order by a range between a preceding and unbounded following) from x; ERROR: argument of RANGE must not contain variables LINE 1: select rank() over (order by a range between a preceding and... ``` Our behaviour now: ``` root@127.0.0.1:60679/movr> CREATE TABLE x (a INT8 PRIMARY KEY) CREATE TABLE root@127.0.0.1:60679/movr> SELECT rank() OVER (ORDER BY a RANGE BETWEEN a PRECEDING AND UNBOUNDED FOLLOWING) FROM x pq: ROWS or RANGE cannot contain variables ``` Release justification: Category 2: Fixes a bug and brings behaviour more in-line with Postgres. Release note (sql change): column references are no longer allowed in ROWS/RANGE clauses in window functions.
40832: opt,sql: disallow column references in ROWS/RANGE r=justinj a=justinj Fixes #38286. This is a departure from the behaviour of the heuristic planner but is actually the same behaviour as Postgres: ``` d=# create table x (a int primary key); CREATE TABLE d=# select rank() over (order by a range between a preceding and unbounded following) from x; ERROR: argument of RANGE must not contain variables LINE 1: select rank() over (order by a range between a preceding and... ``` Our behaviour now: ``` root@127.0.0.1:60679/movr> CREATE TABLE x (a INT8 PRIMARY KEY) CREATE TABLE root@127.0.0.1:60679/movr> SELECT rank() OVER (ORDER BY a RANGE BETWEEN a PRECEDING AND UNBOUNDED FOLLOWING) FROM x pq: ROWS or RANGE cannot contain variables ``` Release justification: Category 2: Fixes a bug and brings behaviour more in-line with Postgres. Release note (sql change): column references are no longer allowed in ROWS/RANGE clauses in window functions. Co-authored-by: Justin Jaffray <justin@cockroachlabs.com>
The text was updated successfully, but these errors were encountered: