phpmyadmin / sql-parser

A validating SQL lexer and parser with a focus on MySQL dialect.

Home Page:https://packagist.org/packages/phpmyadmin/sql-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Syntax error with row_number alias

DorianCoding opened this issue · comments

When using ROW_NUMBER and an alias such as :

SELECT ROW_NUMBER() OVER (ORDER BY `start`)

Phpmyadmin is showing an error but the query works.

It says "An alias was previously found" near the index.

image

Server configuration

  • Operating system: Ubuntu
  • Web server: Nginx + Apache
  • Database version: 10.6.7-MariaDB-2ubuntu1.1 - Ubuntu 22.04
  • PHP version: 8.1.2-1ubuntu2.8
  • phpMyAdmin version: 5.1.1deb5ubuntu1

Client configuration

  • Browser: Firefox 107.0
  • Operating system: Windows 10 64 bits

Bonjour !
Thank you for reporting this issue, I moved it here so we can investigate about it.
@iifawzi I am not sure if any of your recent PRs fix this one ?

I bet that we've seen this bug before, I will take a deeper look

The issue is already fixed by #360 (comment).
Kindly @DorianCoding, can you test with the latest version? (5.2.0)

The issue is already fixed by #360 (comment). Kindly @DorianCoding, can you test with the latest version? (5.2.0)

It seems indeed that the problem is solved using phpmyadmin 5.2 with XAMPP on Windows (with same browser). I guess I just have to wait the update of ubuntu packages then.

The issue is already fixed by #360 (comment). Kindly @DorianCoding, can you test with the latest version? (5.2.0)

It seems indeed that the problem is solved using phpmyadmin 5.2 with XAMPP on Windows (with same browser). I guess I just have to wait the update of ubuntu packages then.

I am the one responsible for the packaging on Ubuntu and Debian, I am quite behind schedule and sorry about that. I will keep you updated

I am the one responsible for the packaging on Ubuntu and Debian, I am quite behind schedule and sorry about that. I will keep you updated

It's been a while, the PPA is updated for Jammy. Can you please check our Wiki for install methods on Ubuntu/Debian

Error is still there in phpMyAdmin 5.2.1
image
Query :
SELECT *, ROW_NUMBER() OVER(PARTITION BY SUBSTR(`created_at`, 1, 10), SUBSTR(`date`, 1, 10), `customer_id` ORDER BY `id` DESC) AS _row_number_ FROM `wp_8_ava_appointments` WHERE `deleted_at` IS NULL

Thank you for confirming this