Re: [SQL] Building a database from a flat file

2005-03-03 Thread Casey T. Deccio
On Thu, 2005-03-03 at 08:28 -0700, Markus Schaber wrote: > - Create the new date in another schema, and then simply rename those > two schemas for "switch over" > This worked very well. I created another schema ("build") and populated the tables within build. Then: BEGIN; ALTER SCHEMA public R

Re: [SQL] Building a database from a flat file

2005-03-03 Thread Casey T. Deccio
On Thu, 2005-03-03 at 06:23 -0700, Sean Davis wrote: > Why not rebuild the entire thing in a separate "build" schema then do > only the stuff like copying tables inside the transaction block: > Building everything in the separate "build" schema works great, but it is the DELETE (TRUNCATE won't wo

[SQL] Building a database from a flat file

2005-03-02 Thread Casey T. Deccio
A database I am currently using is built and updated periodically from a flat csv file (The situation is rather unfortunate, but that's all I have right now). The schema I use is more complex than the flat file, so I follow a process to populate the tables with the data from the file. First I slu

Re: [SQL] table constraints

2005-03-02 Thread Casey T. Deccio
On Tue, 2005-03-01 at 09:56 -0700, Greg Patnude wrote: > foreign keys and primary keys have to be defined as unique at the > table / > column level if you want to implement a check constraint -- your > contrived > example doesn't stand up all that well -- If you want to use > constraints -- > then

Re: [SQL] table constraints

2005-02-28 Thread Casey T. Deccio
On Mon, 2005-02-28 at 18:01 -0700, Andrew - Supernews wrote: > The CHECK is obviously being evaluated prior to the actual insertion > of > the record, whereas the logic of your function clearly expects to be > evaluated after the insertion. > I finally came to that conclusion just a few minutes b

Re: [SQL] table constraints

2005-02-28 Thread Casey T. Deccio
On Mon, 2005-02-28 at 13:20 -0700, Bruno Wolff III wrote: > On Mon, Feb 28, 2005 at 11:28:30 -0800, > "Casey T. Deccio" <[EMAIL PROTECTED]> wrote: > > > > In this case each bldg has an owner associated to it, and each > animal > > lives in some bld

[SQL] table constraints

2005-02-28 Thread Casey T. Deccio
Hi, I am running PostgreSQL 7.4.7. I am having some issues with a constraint for one of my database tables. The code snippet below outlines the code and its output (output is commented). In this case each bldg has an owner associated to it, and each animal lives in some bldg. Each owner has ex