Cool Japanese Things #3

  • Umbrella lockers. In the art museum, there are standard left lockers for storing your bags and coats, but also little vertical lockers for locking up your umbrella while you tour the building! Is this a rainy city? I am thinking, yes.
  • Vertical gas station. Why waste space with gas pumps at ground level when you can just hang the filling hoses down from the ceiling? Hai!
  • Blogging from the car. Taichi has a mifi box, so the laptop works even while we are travelling underneath the triple-decker freeway, heading back to the guesthouse. Zoom zoom zoom.

Cool Japanese Things #2

  • Talks with lots of demos. When you can’t understand the words, nothing talks like demos! I learned about bits of HTML5 for rendering, orientation sensors, location awareness and drag-and-drop!
  • Rice for breakfast. Wrapped in a belt of seaweed to hold it together, a patty of rice about the size of a hockey puck is not that different from a breakfast roll. Should have gotten two.
  • Insane double decker freeways. Running through a canyon of buildings, there’s something very blade-runnerish about the multi-level freeways. How far away is the ground?

Only one not-cool thing, being away from home on Halowe’en. Family is gathered to have wine and snacks right about now and the kids are bouncing off the walls getting ready to head out. Wish I was there.

Cool Japanese Things #1

I am going to feel the lack of a camera on this trip. I didn’t even bother to bring my phone because it would have been a functionless brick.

  • Techno toilet seats. The one in the hotel had an explanation printed on it about why it was not heated. Nonetheless it still had three knobs. There is much more to learn about Japanese toilet seats. Looking forward to it.
  • Defogged mirror. I took a hot shower, got out, and there was a neat square of unfogged mirror area right over the sink! Touch it, yes, it’s warmed from behind to keep the class clear of condensation.
  • Hotel kimono. I don’t feel like getting dressed yes, and I don’t feel like sitting around writing blog posts in the nude. Enter the hotel kimono! It’s a little short for me, but that’s OK.
  • Taxi seats with doilies. Taxi this morning had pretty white lace doilies on the backs of the seats. Also a pristine white seat cover on the back. Curiously despite being lovingly cared for the car itself looked like it dated from 1989.

OpenGovWest BC

There’s an open government conference coming up next month, on November 10 at the University of Victoria: OpenGovWest BC! We are gathering some great local stories, from Vancouver and the Provincial and Federal governments, and a great group of attendees — the kinds of folks looking to change the way government works. If you’re in the area and want to join in, I encourage you to register soon, the fee is nominal and the venue will fill up fast.

PostGIS Back-up / Restore

A very common question on PostGIS in production is “how do I upgrade”, which is actually a variant on “how do I backup and restore”?

First, for patch version increases (e.g. X.Y.Z -> X.Y.(Z+1)) in PostgreSQL and PostGIS you do not need to do anything at all other than install the new software. The data can remain in place and everything will Just Work.

For minor version increases in PostgreSQL (e.g. X.Y.Z -> X.(Y+1).Z) you need to dump and restore. For minor version increases in PostGIS, you need to do a “soft upgrade”, which means leaving the data in place, but running the upgrade scripts (e.g. postgis_upgrade_14_to_15.sql) after you install the software update.

Finally, for major version increases in PostgreSQL and PostGIS (e.g. X.Y.Z -> (X+1).Y.Z) you need to dump and restore.

Which brings me to the actual point I want to make: you can ensure the greatest ease in doing dump and restore of PostGIS data if you ensure that you store no data in the “public” schema.

The “public” schema is where the PostGIS functions and system tables get installed, so if you dump that schema you get all those definitions in your dump. If those definitions are mixed in amongst your data, loading them into a fresh database gets tricky: are the paths to the libraries the same? are there function name clashes? (The utils/ script attempts manfully to strip out PostGIS components from a dump file to allow a clean restore, but it is hard to get 100% performance.)

If, on the other hand, all your data is neatly separated into its own schema, you can neatly backup just that schema and avoid having PostGIS system information mixed in with your data. That means you can easily restore your data into any version of PostGIS and PostgreSQL that you like. So upgrades are easy easy easy.

Remember: Store your data in a schema other than “public”.

“But Paul,” you say, “I already have a full database dump, does that mean I’m SOL?” No, but you will need a strong stomach. First, set up your new PostgreSQL. Create a blank database, load PostGIS into it. Now, load your backup file into that database. You will see lots of errors. However, these errors will be caused by old PostGIS function and type definitions from your dump file conflicting with the existing type definitions in your database. And since you want the new definitions, not the old ones, that’s OK. Your load, despite all the noise and errors, should actually work. Once it’s done, you can move your data into a nice separate schema, so that next time you can do a clean, error-free restore.