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

Decimal cast in orderings throws error upon postgres #365

Open
alekitto opened this issue Oct 29, 2019 · 3 comments
Open

Decimal cast in orderings throws error upon postgres #365

alekitto opened this issue Oct 29, 2019 · 3 comments

Comments

@alekitto
Copy link
Contributor

Ordering upon a text field on a postgres database throws SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type numeric

This is caused by an explicit cast to DECIMAL upon the ordered field into the QOMWalker::walkOrdering method:

$sql = sprintf('CAST(%s AS DECIMAL) %s, %s',

@dbu
Copy link
Member

dbu commented Oct 29, 2019

looking at the code on the line above, we try to look at the numerical_props column. as i understand, we expect it to be numerical, but have to cast because it is the result of an xml xpath operation. what would be the correct thing to do in postgres?

also, is this a changed behaviour in some postgres version? i think we do have tests that order query results and we do test with postgres, so this likely worked at some point...

@alekitto
Copy link
Contributor Author

Could be an error in the persisted data, but i noticed that in the majority of the rows the props xml is replicated into numerical_props column. Could be a bug in a previous version of the library that produced this situation?

How this can be fixed? Should I re-process and re-save all the nodes in the workspace?

@dbu
Copy link
Member

dbu commented Oct 29, 2019

this library is not actively developed. you could have a look at the recent releases to see if anything could have changed this: https://github.com/jackalope/jackalope-doctrine-dbal/releases

or try if it works with 1.3.4 if you recently upgraded to 1.3.5. maybe that join fix had some unexpected side effect...

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