Created
November 23, 2014 14:35
-
-
Save geobabbler/8807cbe35d57d3d2f869 to your computer and use it in GitHub Desktop.
Code snippet 8 for blog post http://blog.geomusings.com/2014/02/18/a-little-deeper-with-node-and-postgis/
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
//SQL to retrieve schema | |
//var sql = "SELECT n.nspname as schemaname,c.relname as table_name,a.attname as column_name,format_type(a.atttypid, a.atttypmod) AS //type,col_description(a.attrelid, a.attnum) as comments"; | |
//sql = sql + " FROM pg_class c INNER JOIN pg_namespace n ON c.relnamespace = n.oid LEFT JOIN pg_attribute a ON a.attrelid = c.oid"; | |
//sql = sql + " WHERE a.attnum > 0 and c.relname = '" + tablename + "' and n.nspname = '" + schemaname + "';"; | |
//SQL to retrieve layer list | |
//sql = "SELECT 'geometry' AS geotype, * FROM geometry_columns UNION SELECT 'geography' as geotype, * FROM geography_columns;"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment