Skip to content
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

row_number() over (partition by)验证不通过,但实际可以执行 #634

Open
gaggki opened this issue Feb 6, 2024 · 6 comments
Open

Comments

@gaggki
Copy link

gaggki commented Feb 6, 2024

描述
对问题简单清晰的描述
row_number() over (partition by)在check的时候不通过会报错,但实际这个语句是可以执行,并且也可以在数据库中执行
重现
模拟重现的步骤
-- 创建表
CREATE TABLE a (
ID INT(10) NULL DEFAULT NULL,
class INT(10) NULL DEFAULT NULL,
score INT(10) NULL DEFAULT NULL
)COLLATE='utf8_general_ci';

-- 插入数据
insert into a values (1,1,90);
insert into a values (2,1,70);
insert into a values (3,1,90);
insert into a values (4,1,80);
insert into a values (5,2,100);
insert into a values (6,2,80);
insert into a values (7,2,110);
insert into a values (8,2,80);
insert into a values (9,2,80);
insert into a values (10,2,60);
commit;

#!/usr/bin/env python

-- coding: utf-8 --

import pymysql
import prettytable as pt

tb = pt.PrettyTable()

sql = '''/*--user=fabu;--password=123456;--host=10.211.55.5;--port=3306;--check=1; */
inception_magic_start;
use test;
select *,row_number() over (partition by class order by score desc) rn from a;
innception_magic_commit;'''

conn = pymysql.connect(host='127.0.0.1', user='', passwd='', db='', port=4000, charset='utf8mb4')

cur = conn.cursor()
ret = cur.execute(sql)
result = cur.fetchall()
cur.close()
conn.close()
tb.field_names = [i[0] for i in cur.description]
for i in result:
tb.add_row(i)
print(tb)

使用以上数据以及表结构和脚本执行
环境

  • 数据库: [mysql/mariadb]
  • 版本: [例如 8.0.21]

参数
可能与问题相关的设置参数

@zmix999
Copy link

zmix999 commented Feb 17, 2024

可以看下我fork的分支,有增加这块功能https://gitee.com/zhoujin826/goInception

@gaggki
Copy link
Author

gaggki commented Feb 18, 2024 via email

@zmix999
Copy link

zmix999 commented Feb 18, 2024

是下载了这个分支在源码编译的吗,或者晚些我上传个二进制包

@gaggki
Copy link
Author

gaggki commented Feb 18, 2024 via email

@zmix999
Copy link

zmix999 commented Feb 18, 2024

代码没上传完成,已重新上传

@zmix999
Copy link

zmix999 commented Feb 18, 2024

也上传了二进制程序

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants