thoughtherder
-
Creating a Spatially-Enable Database in Postgres after Upgrading
Wednesday, May 25, 2011 3:47 p.m.
This post is a reminder to myself on how to rebuild my
template_postgisbecause I never seem to remember how to do it.First things first, stop the db if it’s running. For me, that’s
pg_ctl -D /usr/local/var/postgres stop -s -m fast, which I have aliased aspg-stop.So, you’ve successfully upgraded Postgres. Congrats! Now you want to re-install Postgis. In OS X, that’s
brew install postgis. Even if it’s already there, remove it first. Failing to do so will result in errors down the line. Do it now.Start up Postgres,
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start, or for mepg-start. Next, kill your oldtemplate_postgis. Since it’s a template, you’ll need to do:psql template1 template1=# update pg_database set datistemplate = FALSE template1=# where datname = 'template_postgis'; UPDATE 1 template1=# \q dropdb template_postgisNow we’re ready to create it:
createdb template_postgis -T template1 createlang plpgsql template_postgis cd /usr/local/Cellar/postgis/1.5.2/share/postgis/ psql -d template_postgis -f postgis.sql psql -d template_postgis -f spatial_ref_sys.sql psql template_postgis template_postgis=# pg_database set datistemplate = TRUE template_postgis=# where datname = 'template_postgis'; UPDATE 1 template_postgis=# grant all on geometry_columns to PUBLIC; GRANT template_postgis=# grant all on spatial_ref_sys to PUBLIC; GRANT template_postgis=# VACUUM FREEZE; VACUUM template1=# \qAnd that should be that. We now have a spatially-enabled template that we can use to create other databases with, as such
createdb my_db_name -T template_postgis.References:
-
Arcade Fire – The Suburbs
Friday, November 19, 2010 10:23 a.m.
-
Consider the Lillies
Thursday, November 18, 2010 11:55 a.m.
Have the birds got jobs?
What’s the matter with him?
Says the birds are scrounging.
-
Girl Talk - All Day
Monday, November 15, 2010 3:09 p.m.
New Girl Talk album. Free download.
-
Redis: Under the Hood
Saturday, November 6, 2010 9:45 p.m.
@paulsmith breaks down the initialization phase of a redis server.
-
Raphaël Javascript Library
Saturday, November 6, 2010 5:17 p.m.
Easy, cross-browser vector graphics, right in your DOM. I’m using some svg icons on this site.
-
Backbone.js
Saturday, October 30, 2010 11:36 a.m.
Backbone supplies structure to JavaScript-heavy applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing application over a RESTful JSON interface.
Also, this article of an overview of backbone.js was alright.
-
Promote.js
Thursday, October 28, 2010 11:38 p.m.
For better javascript documentation.
-
Julian Lynch - Seed
Wednesday, October 27, 2010 6:44 p.m.
-
RMV : Cut Rubies with ease!
Tuesday, October 26, 2010 12:26 p.m.
RVM is a command line tool which allows us to easily install, manage and work with multiple ruby environments from interpreters to sets of gems.

