Created
September 18, 2012 15:39
-
-
Save judy2k/3743815 to your computer and use it in GitHub Desktop.
Column Description
This file contains 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
DROP FUNCTION IF EXISTS coldesc(); | |
CREATE FUNCTION coldesc() RETURNS TABLE(COL text,VAL text) AS $$ | |
DECLARE | |
COL text; | |
Q text; | |
BEGIN | |
Q := 'SELECT ''boundary'' as COL, boundary AS VAL FROM planet_osm_line GROUP BY boundary'; | |
FOREACH COL IN ARRAY ARRAY['barrier', 'bicycle', 'bridge', 'boundary', 'building', 'construction'] | |
LOOP | |
RAISE NOTICE '%', Q; | |
Q := Q || ' UNION SELECT ''' || col || ''' AS COL, ' || COL || ' AS VAL FROM planet_osm_line GROUP BY ' || COL; | |
END LOOP; | |
Q := Q || ' ORDER BY COL'; | |
RETURN QUERY EXECUTE Q; | |
END; | |
$$ LANGUAGE plpgsql; | |
select * from coldesc(); |
This file contains 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
-- Table: planet_osm_line | |
-- DROP TABLE planet_osm_line; | |
CREATE TABLE planet_osm_line | |
( | |
osm_id integer, | |
access text, | |
"addr:housenumber" text, | |
"addr:interpolation" text, | |
admin_level text, | |
aerialway text, | |
aeroway text, | |
amenity text, | |
area text, | |
barrier text, | |
bicycle text, | |
bridge text, | |
boundary text, | |
building text, | |
construction text, | |
cutting text, | |
disused text, | |
embankment text, | |
foot text, | |
highway text, | |
historic text, | |
horse text, | |
junction text, | |
landuse text, | |
layer text, | |
leisure text, | |
lock text, | |
man_made text, | |
military text, | |
motorcar text, | |
name text, | |
"natural" text, | |
oneway text, | |
operator text, | |
power text, | |
power_source text, | |
place text, | |
railway text, | |
ref text, | |
religion text, | |
route text, | |
service text, | |
shop text, | |
sport text, | |
tourism text, | |
tracktype text, | |
tunnel text, | |
waterway text, | |
width text, | |
wood text, | |
z_order integer, | |
way_area real, | |
way geometry | |
) | |
WITH ( | |
OIDS=FALSE | |
); | |
ALTER TABLE planet_osm_line | |
OWNER TO mark; | |
GRANT ALL ON TABLE planet_osm_line TO mark; | |
GRANT SELECT ON TABLE planet_osm_line TO public; | |
-- Index: planet_osm_line_index | |
-- DROP INDEX planet_osm_line_index; | |
CREATE INDEX planet_osm_line_index | |
ON planet_osm_line | |
USING gist | |
(way ); | |
-- Index: planet_osm_line_pkey | |
-- DROP INDEX planet_osm_line_pkey; | |
CREATE INDEX planet_osm_line_pkey | |
ON planet_osm_line | |
USING btree | |
(osm_id ); |
This file contains 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
Column | Type | Modifiers | |
--------------------+----------+----------- | |
osm_id | integer | | |
access | text | | |
addr:housenumber | text | | |
addr:interpolation | text | | |
admin_level | text | | |
aerialway | text | | |
aeroway | text | | |
amenity | text | | |
area | text | | |
barrier | text | | |
bicycle | text | | |
bridge | text | | |
boundary | text | | |
building | text | | |
construction | text | | |
cutting | text | | |
disused | text | | |
embankment | text | | |
foot | text | | |
highway | text | | |
historic | text | | |
horse | text | | |
junction | text | | |
landuse | text | | |
layer | text | | |
leisure | text | | |
lock | text | | |
man_made | text | | |
military | text | | |
motorcar | text | | |
name | text | | |
natural | text | | |
oneway | text | | |
operator | text | | |
power | text | | |
power_source | text | | |
place | text | | |
railway | text | | |
ref | text | | |
religion | text | | |
route | text | | |
service | text | | |
shop | text | | |
sport | text | | |
tourism | text | | |
tracktype | text | | |
tunnel | text | | |
waterway | text | | |
width | text | | |
wood | text | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment