From: <er...@je...> - 2007-08-15 18:41:19
|
The list in the config file was implementation of a suggestion to =20 silence some warnings in some of the database maintenance routines. I =20 think I have a better method to accomplish this so we could eliminate =20 this instance. I like the idea of a magic cookie with the files. Thanks, Eric Quoting Bill Fenner <fe...@gm...>: > We've had a couple of failed ways to store the list of scripts to run > when you run "pg --init": > > - A list in the script > - A list in the config file > > The list in the script had the problem that developers forgot to > update it when adding new files. The list in the config file has two > problems: developers still forget to update it, and config file > management gets harder when upgrading because the sysadmin may need to > update this part of the config file. > > I am trying to brainstorm about how to just use the contents of the > directory so that any sql file that gets dropped in gets executed at > init time. I started with the idea of running "*.sql" minus upgrade*, > but it may be possible for database backups to end up in there too, > and once you have to exclude upgrade* and db_back* you start wondering > what else you should be excluding and forgot to. > > So, I thought about an inclusion mechanism that works in the directory > itself. My current idea is a magic cookie inside each sql file (e.g. > -- INIT) that says that this file should be loaded by "pg --init", and > pg reads each file to decide whether or not to include it. This means > there's still something to forget - the magic cookie in the file - but > it avoids the config file maintenance problem and somewhat mitigates > the "centralized list" problem since you don't have to edit two files > when adding a new table, you just have to remember the cookie. > > Any other thoughts? > Thanks, > Bill |