Re: [SQL] Database Upgrade scripts (AKA Conditional SQL execution)

2003-07-07 Thread Joe Conway
Richard Rowell wrote: Can I accomplish this with postgresql without involving an external process (like say perl)? I guess I could put the upgrade stuff into PL/SQL functions and just drop the functions when I'm done, but I was hoping for something a little "cleaner". There is no way (currently at

[SQL] Database Upgrade scripts (AKA Conditional SQL execution)

2003-07-07 Thread Richard Rowell
Moving to Postgres from MS SQL server wherever I can. When writing database upgrade scripts, it is nice to construct the script so it will run correctly even if run twice. In MS-SQL's TSQL I would do something like this: IF( SELECT COUNT(*) FROM sysobjects WHERE name = 'foo' AND type ='U' ) < 1