Support type="double" for columns#2488
Open
amandasaurus wants to merge 1 commit into
Open
Conversation
joto
requested changes
Jun 5, 2026
Collaborator
joto
left a comment
There was a problem hiding this comment.
We need tests for this, I suggest in tests/test-output-flex-types.cpp . If you can't run the tests locally, you'll see the results of the test run in your branch on Github.
| {"int8", table_column_type::int8}, | ||
| {"bigint", table_column_type::int8}, | ||
| {"real", table_column_type::real}, | ||
| {"double", table_column_type::double_}, |
Collaborator
There was a problem hiding this comment.
To avoid the awkward C++ name double_, maybe name it double_precision? double is okay for the Lua side, I am only talking about the C++ side here.
| throw fmt_error("Invalid type '{}' for real column.", | ||
| lua_typename(lua_state, ltype)); | ||
| } | ||
| } else if (column.type() == table_column_type::double_) { |
Collaborator
There was a problem hiding this comment.
Because this is just a copy of the code for the real type (except the one place in the error message), I think we can do both in one if-condition with "type=real or type=double" and change the error message to "...for real/double column".
27c635b to
01c20c7
Compare
It already supports `real`, which is single precision floating point in PostgreSQL. This patch adds `type = "double"` for PostgreSQL `double precision` columns
01c20c7 to
ee11855
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
osm2pgsql already supports
real, which is single precision floating point in PostgreSQL. This patch addstype = "double"for PostgreSQLdouble precisioncolumns.Users were still able to add this type of column with
sql_type = "double precision"}(e.g. postpass lua). But this makes it easier.Lua uses double precision floating point types by default.
This PR is in draft, because I was unable to run the tests. I have successfully tested this code locally. But I am not confident enough with how the interacts with lua. I would appreciate someone confirming it's OK.
Documentation for this is on my
osm2pgsql-websitefork