phpmyadmin / phpmyadmin/sql-parser

phpMyAdmin 5.2.3 export fails with RuntimeException: No statement inside WITH for views containing nested CTEs

オープン
#666 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
PHP
スター
485
フォーク
119
PR マージ指標
30日以内にマージされた PR はありません

説明

When exporting a database/schema from phpMyAdmin 5.2.3, the export fails if a view contains a nested CTE (WITH inside another WITH).

The view itself is valid in MariaDB and can be created, queried, and retrieved successfully using SHOW CREATE VIEW. However, during phpMyAdmin export, phpMyAdmin creates the temporary stand-in definition for the view and then terminates with:

RuntimeException: No statement inside WITH
Because the export terminates at this point, the final CREATE VIEW definitions that phpMyAdmin normally writes near the end of the export are missing from the generated SQL file.

Simple reproduction steps: (MariaDB 10.11.16)
DROP VIEW IF EXISTS test_nested_cte_view;

CREATE VIEW test_nested_cte_view AS
WITH outer_cte AS
(
WITH inner_cte AS
(
SELECT 1 AS id, 'test' AS name
)
SELECT id, name
FROM inner_cte
)
SELECT id, name
FROM outer_cte;

Then perform a SQL export of the database/schema through phpMyAdmin.
The export then terminates with:
RuntimeException: No statement inside WITH

Expected result

phpMyAdmin should successfully export a valid MariaDB view containing nested CTEs and include its complete CREATE VIEW definition in the SQL export.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、ネストされたCTEを持つビューとMariaDBスキーマのSQLエクスポートを使って失敗を再現し、報告されたRuntimeExceptionを入口として調査します。Parserによる一時的な代替ビュー定義の処理を追跡してください。エクスポートが完了し、完全なCREATE VIEW定義が含まれていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
mariadb, php, sql
領域
databases, tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。