Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4547 closed defect (fixed)

hstore-column tags filtered out by mistake

Reported by: Schuyler Erle Owned by: jburgess777@…
Priority: minor Milestone:
Component: osm2pgsql Version:
Keywords: Cc:

Description

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.

Attachments (1)

fix-hstore-columns.patch (1.2 KB) - added by Schuyler Erle 7 years ago.

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by Schuyler Erle

Attachment: fix-hstore-columns.patch added

comment:1 Changed 7 years ago by Schuyler Erle

Resolution: fixed
Status: newclosed

Fixed by r28671 at apmon's invitation.

comment:2 Changed 7 years ago by amm

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.

comment:3 in reply to:  2 Changed 7 years ago by Schuyler Erle

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.

comment:4 Changed 7 years ago by Schuyler Erle

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.

Note: See TracTickets for help on using tickets.