phpmyadmin / phpmyadmin/phpmyadmin

Export using user defined variables results in NULL

Open
#12,870 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
PHP
Stars
7.9k
Forks
3.6k
Avg merge
4d 18h
Merged PRs (30d)
36

Description

From http://stackoverflow.com/questions/41428627/phpmyadmin-export-with-generic-field

I have a query which works fine in view:

SET @c := 0;
SELECT ( SELECT @c := @c + 1 ) AS rowNum, email FROM HS_mailList;

However when I use the export function of the query result, the "rowNum" field shows NULL in the CSV. I guess it is NULL because the SET query is not processed and my "c" var is null. I think that's it, because phpMyAdmin shows the SELECT query only, after executing the SET and SELECT combination on top. On the other hand when clicking on "show sql-querybox" it still remembers both.

Using master, I tried the same on sakila with:
SET @c := 0;
SELECT ( SELECT @c := @c + 1 ) AS rowNum, first_name FROM actor;
I got the same incorrect result.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named in the report. Reproduce the issue with the provided SET and SELECT statements against sakila, compare the query view with the export path, and trace how the combined query is handled. Done means the CSV export preserves the computed rowNum values instead of emitting NULL.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.