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

Editing records with a Point column causes value to be lost #19196

Closed
gammalogic opened this issue Jun 12, 2024 · 2 comments
Closed

Editing records with a Point column causes value to be lost #19196

gammalogic opened this issue Jun 12, 2024 · 2 comments

Comments

@gammalogic
Copy link

gammalogic commented Jun 12, 2024

Describe the bug

If I edit any records in PHPMyAdmin that have previously had Point values saved to them the Point values are blank after I update the record.

To Reproduce

I am adding Point values to the records in my database like this:

UPDATE `records`
SET
    `record_lat_lng` = ST_GeomFromText('POINT(51.5116344 -0.2249017)')
WHERE `record_id` = '1000'
LIMIT 1;

If I then edit the record in PHPMyAdmin the column value looks like this

PHPMyAdmin

but if I click on the "Go" button (without making any changes) the value in the column is then set to NULL. The UPDATE query as reported by PHPMyAdmin is:

UPDATE `records`
SET
    `record_lat_lng` = ST_GeomFromText('\'POINT(51.5116344 -0.2249017)\',0')
WHERE `records`.`record_id` = 1000;

It seems that the values are being quoted and/or escaped incorrectly?

If I run another query to update the record again (to revert it back to its original values), edit the record in PHPMyAdmin and remove the quotes from the column edit field the value is not lost after I click on the "Go" button:

PHPMyAdmin

The UPDATE query as reported by PHPMyAdmin is:

UPDATE `records`
SET
    `record_lat_lng` = ST_GeomFromText('POINT(51.5116344 -0.2249017),0')
WHERE `records`.`record_id` = 1000;

This UPDATE query runs correctly and no rows are updated (because no changes are made).

Server configuration

  • Operating system: Linux
  • Web server: Apache 2.4.59
  • Database version: 10.6.18-MariaDB-cll-lve-log
  • PHP version: 8.1.27
  • phpMyAdmin version: 5.2.1

Additional context

Editing a record by using the UI to add new point values also doesn't work because the value is quoted/escaped incorrectly when the record is updated and the point value is NULL afterwards.

@MoonE
Copy link
Contributor

MoonE commented Jun 16, 2024

This should be fixed in the latest snapshot:
https://www.phpmyadmin.net/downloads/#snapshot_5.2+snapshot

See here in case the download doesn't work:
phpmyadmin/website#164 (comment)

@gammalogic
Copy link
Author

Thank you for your help. The site I am working on is on a shared server with cPanel so I will have to wait for the installed version of PHPMyAdmin to be updated. For now, I decided to save the latitude/longitude coordinates as Double values instead and then convert the values to a Point value inside my geospatial queries. Possibly not efficient, but it works fine. Thanks for everyone's work on the project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants