sql-parser icon indicating copy to clipboard operation
sql-parser copied to clipboard

Syntax error with row_number alias

Open DorianCoding opened this issue 2 years ago • 10 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

DorianCoding avatar Nov 20 '22 10:11 DorianCoding

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 ?

williamdes avatar Nov 20 '22 12:11 williamdes

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

iifawzi avatar Nov 21 '22 10:11 iifawzi

The issue is already fixed by https://github.com/phpmyadmin/sql-parser/pull/360#issuecomment-954721943. Kindly @DorianCoding, can you test with the latest version? (5.2.0)

iifawzi avatar Nov 21 '22 11:11 iifawzi

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.

DorianCoding avatar Nov 21 '22 16:11 DorianCoding

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

williamdes avatar Nov 21 '22 17:11 williamdes

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

williamdes avatar Apr 21 '23 19:04 williamdes

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

tristan-charbonnier avatar Apr 20 '24 22:04 tristan-charbonnier

Thank you for confirming this

williamdes avatar Apr 20 '24 23:04 williamdes