mroswell (4) [Avatar] Offline
I'm on Windows, and I installed PgAdmin III. I chose the Execute Arbitrary SQL queries button, which brought up the Query window. I entered


and received this error:

********** Error **********

ERROR: CREATE DATABASE cannot be executed from a function or multi-command string
SQL state: 25001

What do I need to do to make this work?

I just figured it out! I right-clicked on schema in pgAdmin III

Since we're encouraged to use this pgAdmin tool, it might be helpful to spell that out.

(Since the book guided us to enter CREATE SCHEMA ch01, I still wonder what I'm missing, in terms of where to enter that command.)
regina.leo (254) [Avatar] Offline
Re: error on CREATE SCHEMA ch01;
Will do. Thanks.
regina.leo (254) [Avatar] Offline
Re: error on CREATE SCHEMA ch01;
Actually just realized I'm not sure where you got to this point. The Create SCHEMA we have is a separate command from creating the database. Were you running the whole code01.sql file?
michaelmcbain (2) [Avatar] Offline
Re: error on CREATE SCHEMA ch01;
This isn't quite on -topic for this thread, but could I suggest,Regina and Leo, that it would make more sense to the novice user if the schema name, rather than being ch01, was something useful like 'restaurant', or even not introduce the use of schemas this early in the book? In edition 1, I couldn't understand why you'd want to create a schema, or what use it was. Only much later when I was converting large sets of shapefiles, did I relaise that schemas were definitely the way to go, but that they needed to have names that made sense. As a schema, ch01 doesn't.
regina.leo (254) [Avatar] Offline
Re: error on CREATE SCHEMA ch01;

We thought about that, but decided to partition our book data by chapters. For backup and restore reasons, this translated nicely to using schema for that partitioning. Perhaps we should have explained that better (and we will) that the use of schemas is a logical container based on how you want to manage data (for backup, security, theme). To be honest, partitioning by chapter makes as much sense to me as any other kind of partitioning whether that be geographical (where gasp you have a different restaurants table for each geography), data theme, etc. It's all up to what makes the most sense for the data manager to see as a unit and to manage as a unit.

Others have suggested we should have started out with one grande example and then carried it thru the book building it up. I think if we had done that your suggestion would have fit better. Then again it suffers from the problem of having to read the book in sequence and we didn't want a book that you had to read in sequence since this book is geared for both novices and non-novices. I think the better solution would be to just write a different book more specifically geared for novices. rather than trying to satisfy all audiences with one book. We are thinking about that too.