Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid SQL generated when PRIMARY/UNIQUE key contains a POINT column #17474

Closed
1bakedpotato opened this issue Apr 3, 2022 · 1 comment · Fixed by #17476
Closed

Invalid SQL generated when PRIMARY/UNIQUE key contains a POINT column #17474

1bakedpotato opened this issue Apr 3, 2022 · 1 comment · Fixed by #17476
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
Milestone

Comments

@1bakedpotato
Copy link

1bakedpotato commented Apr 3, 2022

Describe the bug

When browsing a table that uses a POINT column in its PRIMARY/UNIQUE key, phpMyAdmin will generate invalid per-row WHERE conditions in that there's a superfluous trailing AND keyword. This results in SQL errors when clicking any blob field's download link or the row's edit/copy/delete links.

To Reproduce

  1. Create test table (engine seems to not matter, so long as it supports the POINT type):
CREATE TABLE pmabug (
  id int(11) NOT NULL,
  coord point NOT NULL,
  UNIQUE(coord)
) ENGINE=InnoDB;
  1. Insert a couple of rows:
INSERT INTO
  pmabug (id, coord)
VALUES
  (1, POINT(1, 2)),
  (2, POINT(2, 4))
  1. Click the Browse link for the table.
  2. Observe no warning for table missing a PRIMARY/UNIQUE key and that per-row Edit/Copy/Delete links are available.
  3. Click one of the rows' Edit link.

Expected behavior

The normal UI for editing a unique row's values is displayed.

Actual behavior

A SQL query error is displayed, with the malformed query looking like:

SELECT
  *
FROM
  `test`.`pmabug`
WHERE
  `pmabug`.`coord` =0x00000000010100000000000000000000400000000000001040
  AND
;

Server configuration

  • Operating system: Windows 10
  • Web server: Apache
  • Database version: 10.1.46-MariaDB - mariadb.org binary distribution
  • PHP version: 8.0.13
  • phpMyAdmin version: 5.1.1, 5.1.3, and 5.2.0-rc1

Client configuration

  • Browser: Firefox 98.0.2
  • Operating system: Windows 10
@williamdes williamdes added the Bug A problem or regression with an existing feature label Apr 3, 2022
@williamdes williamdes added this to the 5.1.4 milestone Apr 3, 2022
@williamdes williamdes added this to Needs triage in issues via automation Apr 3, 2022
@williamdes
Copy link
Member

Hi,
Thank you for reporting this issue!

@MauricioFauth MauricioFauth self-assigned this Apr 5, 2022
@MauricioFauth MauricioFauth added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Apr 5, 2022
MauricioFauth added a commit that referenced this issue Apr 5, 2022
[ci skip]

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
issues automation moved this from Needs triage to Closed Apr 5, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
issues
  
Closed
Development

Successfully merging a pull request may close this issue.

3 participants