Created
June 30, 2013 02:17
-
-
Save pnorman/5893523 to your computer and use it in GitHub Desktop.
outlines the cgimap nodes flow and some hstore limitations with libpqxx
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
CREATE TEMPORARY TABLE tmp_nodes ( | |
id bigint primary key, | |
geom geometry, -- postgis geometry | |
-- actually other columns as well | |
tags hstore); | |
-- nodes has the same columns and indexes as tmp_nodes, bout about 2 billion rows | |
INSERT INTO tmp_nodes SELECT * FROM nodes WHERE ...; -- assorted WHERE clauses | |
-- more inserts with joins, complicated conditions, etc | |
-- what I currently do | |
SELECT id,geom FROM tmp_nodes; | |
-- store the results in my C++ code | |
-- then loop in C++ over the results, and for each row do | |
SELECT (each(tags)).key as k, (each(tags)).value as v FROM tmp_nodes WHERE id=$1; | |
-- Then do stuff with these results | |
-- What I can't do due to libpqxx limitations: | |
SELECT id,geom,tags FROM tmp_nodes; | |
SELECT id,geom,hstore_to_array(tags) FROM tmp_nodes; | |
-- anything else involving an array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment