Re: [SQL] avoid circular references

2003-11-05 Thread Jerome Alet
On Wed, Nov 05, 2003 at 09:15:39PM -0800, Josh Berkus wrote: > Jerome, > > > Each object can contain one or many other objects from the same > > table, so I guess this relationship can be expressed with something > > like : > > This is called a "tree structure". Thanks ! > > CREATE TABLE cont

Re: [SQL] avoid circular references

2003-11-05 Thread Josh Berkus
Jerome, > Each object can contain one or many other objects from the same > table, so I guess this relationship can be expressed with something > like : This is called a "tree structure". > CREATE TABLE contains (id SERIAL PRIMARY KEY NOT NULL, > containerid INTEGER REFERENCES objtable(ido

Re: [SQL] [HACKERS] Schema boggle...

2003-11-05 Thread Josh Berkus
Chris, > Monolithic tables have their uses, I don't and wont contest that, however > we've been using a monolithic structure in our current AMS distribution and > dataset. That and I'm more confident working on a 3D level, versus 2D, the > schema levels introduce the third dimension into my str

[SQL] avoid circular references

2003-11-05 Thread Jerome Alet
Hi there, I've got a table 'objtable' of objects which primary id is 'idobj' of type serial. objtable : idobj objname 1 nameone 2 nametwo 3 namethree ... Each object can contain one or many other objects f

Re: [SQL] Select and functions

2003-11-05 Thread Jeff Eckermann
--- "Stephen J. Thompson" <[EMAIL PROTECTED]> wrote: > But if I use it in a before trigger the procedure > fails to work. > > CREATE OR REPLACE FUNCTION > staging.write_work_country() > RETURNS trigger AS > ' > DECLARE > alias_rec RECORD; > BEGIN > -- Cl

Re: [SQL] Select and functions

2003-11-05 Thread terry
You need to use 2 single quotes: CREATE OR REPLACE FUNCTION staging.write_work_country() RETURNS trigger AS ' DECLARE alias_rec RECORD; BEGIN -- Clean the phone number NEW.worktelephonenumber = REPLACE(NEW.worktelephonenumber,'' '',

[SQL] Select and functions

2003-11-05 Thread Stephen J. Thompson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello all, I am having a little bit of trouble here. If I use the replace function in a select statement all works as expected. select firstname, lastname, replace(worktelephonenumber, ' ', '') AS worktel from contacts; But if I use it in a befor

Re: [SQL] Please help me to slove this SQL statements

2003-11-05 Thread Patrick JACQUOT (DSI NOISIEL)
-Message d'origine- De : Freshman [mailto:[EMAIL PROTECTED] Envoyé : jeudi 30 octobre 2003 13:38 À : [EMAIL PROTECTED] Objet : [SQL] Please help me to slove this SQL statements There are three table in database which is suppliers, projects, and shipments suppliers contain suppliers id,