Skip to content

Fix #74779: x() and y() truncating floats to integers #6665

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

Closed
wants to merge 2 commits into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Feb 4, 2021

We must not use the locale dependent atof(), but instead use the
(hopefully) locale independent zend_strtod(), when converting string
representations of floating point numbers which are sent by the server.


According to the documentation there is no way to change LC_NUMERIC for the server, so we can expect the server to always sent string representations of floating point numbers with a dot as decimal separator. I'm not sure about that, though, particularly wrt. the MySQL forks.

Also, if zend_strtod() is built with USE_LOCALE defined, we're back at square one. I think we can ignore that possibility, though, since it likely would break other stuff as well.

We must not use the locale dependent `atof()`, but instead use the
(hopefully) locale independent `zend_strtod()`, when converting string
representations of floating point numbers which are sent by the server.
@cmb69 cmb69 added the Bug label Feb 4, 2021
Copy link
Member

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are also uses of atof in pgsql.c, though only for version comparison.

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

Successfully merging this pull request may close these issues.

2 participants