Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

row_number() over sql parse error #615

Copy link
Copy link
@attson

Description

@attson
Issue body actions

eg:

        $sql = <<<EOF
select id,
       pid,
       appid,
       appname,
       row_number() over (partition by pid, appid) as `group_row_number`
from game group by appname
EOF;

        $parser = new \PhpMyAdmin\SqlParser\Parser($sql);

        dump($parser->statements[0]->build());
        dump($parser->statements[0]->expr);

output:

SELECT id, pid, appid, appname, row_number()  (partition by pid, appid) AS `over` FROM game GROUP BY appname

...

  4 => PhpMyAdmin\SqlParser\Components\Expression
    +database: null
    +table: null
    +column: "row_number"
    +expr: "row_number()  (partition by pid, appid)"
    +alias: "over"
    +function: "row_number"
    +subquery: null
  }

...

expected

return an incorrect alias, expected to be group_row_number.

env

PHP 8.1.30 (cli) (built: Sep 27 2024 04:07:29) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.30, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.30, Copyright (c), by Zend Technologies
    with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans

phpmyadmin/sql-parser 5.10.1

phpmyadmin/sql-parser 5.10.3 same error

Reactions are currently unavailable

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.