Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

hstore-column tags filtered out by mistake #4547

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 4 comments
Closed

hstore-column tags filtered out by mistake #4547

openstreetmap-trac opened this issue Jul 23, 2021 · 4 comments

Comments

@openstreetmap-trac
Copy link

Reporter: Schuyler Erle
[Submitted to the original trac issue database at 6.39pm, Thursday, 30th August 2012]

Some combination of r7371 and r28156 added the removal of unused tags from the keyval structure passed to pgsql_filter_tags(), but this has the unwanted effect of removing tags that would otherwise be stored in an hstore column via the --hstore-column option before pgsql_out_*() get to write them.

This comment at line 772 of output-pgsql.c is telling:

/* We used to only go far enough to determine if it's a polygon or not,
but now we go through and filter stuff we don't need */

I think this change was made without regard to --hstore-column by accident.

The attached patch updates pgsql_filter_tags() to retain tags with a prefix matching any --hstore-column. The feature is only retained if --hstore-match-only is set, as with the normal --hstore option. This should restore the expected behavior of --hstore-column.

@openstreetmap-trac
Copy link
Author

Author: Schuyler Erle
[Added to the original trac issue at 7.50pm, Friday, 31st August 2012]

Fixed by r28671 at apmon's invitation.

@openstreetmap-trac
Copy link
Author

Author: amm
[Added to the original trac issue at 12.48am, Monday, 3rd September 2012]

Your patch caused segmentation faults when using the --hstore or --hstore-all option.

I think the error is that you used an "if" instead of an "else if", resulting in a double free if --hstore but not --hstore-column was used.

I have committed that fix, but it would be good if you could double check that this doesn't break the functionality.

Also in future it might be good to run

"./tests/regression-test.sh liechtenstein.osm.pbf minutely-diff.osc.gz"

before committing, to check that the various option combinations work.

@openstreetmap-trac
Copy link
Author

Author: Schuyler Erle
[Added to the original trac issue at 6.00am, Monday, 3rd September 2012]

Thanks very much for finding this. Your fix is exactly right. I didn't know about the regression tests -- or else I would have run them to be sure.

@openstreetmap-trac
Copy link
Author

Author: Schuyler Erle
[Added to the original trac issue at 12.51am, Tuesday, 4th September 2012]

r28671 introduced a logic bug in r28671 that made the return value of pgsql_filter_tags() incorrect when --hstore-column was set. Fixed by r28686.

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

No branches or pull requests

1 participant