Skip to content

[BUG]oracle.py查询功能filter_sql函数遇到查询语句的子查询带rownum会有问题,建议进行如下改写,这样count(*)的查询bug也不会有 #700

@jan-song

Description

@jan-song
def filter_sql(self, sql='', limit_num=0):
    sql_lower = sql.lower()
    # 对查询sql增加limit限制
    if re.match(r"^select", sql_lower):
       sql=f"select a.* from ({sql.rstrip(';')}) a WHERE ROWNUM <= {limit_num}"
    return sql.strip()

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/oraclebugSomething isn't workingwontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions