[Tile-serving] [openstreetmap/osm2pgsql] allow more numeric datatypes for table columns in C tagtransform (#630)
Paul Norman
notifications at github.com
Fri Oct 28 09:19:50 UTC 2016
pnorman commented on this pull request.
I haven't run or compiled this yet
> };
struct taginfo {
taginfo();
taginfo(const taginfo &);
+ ColumnType column_type() const {
+ if (flags & FLAG_INT_TYPE)
+ return COLUMN_TYPE_INT;
+ if (flags & FLAG_REAL_TYPE)
+ return COLUMN_TYPE_REAL;
code style issue: missing {} after ifs
> @@ -24,6 +23,17 @@ static const std::map<std::string, int> tagflags = {
{"nocolumn", FLAG_NOCOLUMN}
};
+static const std::map<std::string, int> tagtypes = {
+ {"smallint", FLAG_INT_TYPE},
+ {"integer", FLAG_INT_TYPE},
+ {"bigint", FLAG_INT_TYPE},
+ {"int2", FLAG_INT_TYPE},
+ {"int4", FLAG_INT_TYPE},
+ {"int8", FLAG_INT_TYPE},
+ {"real", FLAG_REAL_TYPE},
`double precision` is another real type
> @@ -145,6 +153,13 @@ int read_style_file( const std::string &filename, export_list *exlist )
temp.type.assign(datatype);
temp.flags = parse_tag_flags(flags, lineno);
+ try {
+ temp.flags |= tagtypes.at(temp.type);
+ } catch (std::out_of_range const &e) {
+ fprintf(stderr, "Bad datatype '%s' in style file line %d\n", datatype, lineno);
An unknown datatype should be a warning, not an error. e.g. `character varying`, `varchar`, `char(255)` are all valid types for arbitrary OSM data.
Also, it shouldn't warn if using Lua transforms because any column type can be valid there, including stranger ones like enumerated types, `text[]`, `hstore`, and `jsonb`
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/630#pullrequestreview-6209243
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20161028/968461c9/attachment.html>
More information about the Tile-serving
mailing list