-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Preserve 0/NULL values from postgres int columns #2207
Conversation
…ctly Currently failing
@m-kuhn should we also add an equality operator to QgsAttributes which can work around this upstream issue? |
BTW, thanks for looking into this. I'd also encountered this earlier in the week and was totally confused by what was happening... |
@nyalldawson like so? |
@m-kuhn looks good to me... I'm curious though, why go through the attributes backwards? |
@nyalldawson because the Qt QVector implementation does it that way :) |
@m-kuhn OK fair enough... Thought there may have been some complex c++ reason behind it :p the test + attribute changes should be safe to merge now, right? |
still struggling with sip... |
ca6b939
to
69be0c1
Compare
Actually, the headline only says half of it. I think this patch is fine to apply but it does not solve the underlying problem.
It seems that the check on this line here fails to properly distinguish 0 from NULL in the attributes
https://github.com/qgis/QGIS/blob/master/src/core/qgsfeature.cpp#L97
We could as well remove the check and have some unnecessary detaches happen once in a while (not sure how often or bad that would be).
The underlying problem is that IIRC Qt returns true for
QVariant(int) == QVariant(0)
a thing that should be solved upstream. We could maybe implement our own helper method to compare QVariants and have it take care of such things.@jef-n assigning you since you are the postgres provider wizard.
Thoughts?