[SQL] UPDATE Trigger on multiple tables

2005-10-12 Thread Ferindo Middleton Jr
Is it possible to have a single trigger on multiple tables simultaneously? Example: CREATE TRIGGER emp_cust_stamp BEFORE INSERT OR UPDATE ON employees, customers FOR EACH ROW EXECUTE PROCEDURE last_updated_stamp(); I tried something like the above but get an error message at the comma. I tri

Re: [SQL] Why doesn't the SERIAL data type automatically have a

2005-10-04 Thread Ferindo Middleton Jr
Richard Huxton wrote: Jim C. Nasby wrote: Is there some reason why the SERIAL data type doesn't automatically have a UNIQUE CONSTRAINT. It used to, and then we decoupled it. [snip] Arguably it would have been better to make the default case add either UNIQUE or PRIMARY KEY with a way to over

Re: [SQL] Why doesn't the SERIAL data type automatically have a

2005-10-04 Thread Ferindo Middleton Jr
Jim C. Nasby wrote: On Tue, Sep 27, 2005 at 10:33:14AM -0500, Scott Marlowe wrote: On Mon, 2005-09-26 at 20:03, Tom Lane wrote: Ferindo Middleton Jr <[EMAIL PROTECTED]> writes: Is there some reason why the SERIAL data type doesn't automatically have a UNIQUE

[SQL] changing a column's position in table, how do you do that

2005-09-27 Thread Ferindo Middleton Jr
Is there a way to change the position attribute of a column in a table? I have data that I need to import into various tables in my db on a consistent basis... I usually us e the COPY ... FROM query but I can't control the -order- of the fields my client dumps the data so I would like to be abl

Re: [SQL] Why doesn't the SERIAL data type automatically have a UNIQUE

2005-09-26 Thread Ferindo Middleton Jr
w more of a one-size-fits-all philosophy. And hey, how hard can it be to add the word UNIQUE when I'm creating tables? Ferindo Tom Lane wrote: Ferindo Middleton Jr <[EMAIL PROTECTED]> writes: Is there some reason why the SERIAL data type doesn't automatically have a UNIQU

[SQL] Why doesn't the SERIAL data type automatically have a UNIQUE CONSTRAINT

2005-09-26 Thread Ferindo Middleton Jr
Is there some reason why the SERIAL data type doesn't automatically have a UNIQUE CONSTRAINT. It seems that the main reason for using it is so that the value for this field keeps changing automatically and is never null so any one record can be identified using it- So why not imply that it is a

Re: [SQL] redundancy in CHECK CONSTRAINTs

2005-09-24 Thread Ferindo Middleton Jr
refer to them. Thank you. Ferindo Tom Lane wrote: Ferindo Middleton Jr <[EMAIL PROTECTED]> writes: I have the following table: CREATE TABLE gyuktnine ( id SERIAL, intsystem INTEGER NOT NULL REFERENCES yuksystems(id) CONSTRAINT int_canno

[SQL] redundancy in CHECK CONSTRAINTs

2005-09-24 Thread Ferindo Middleton Jr
I have the following table: CREATE TABLE gyuktnine ( id SERIAL, intsystem INTEGER NOT NULL REFERENCES yuksystems(id) CONSTRAINT int_cannot_equal_ext CHECK (intsystem != extsystem), extsystem INTEGER NOT NULL REFERENCES yuksystems(id) CONSTR

[SQL] showing multiple REFERENCE details of id fields in single query that share the same table

2005-09-14 Thread Ferindo Middleton Jr
I have a table which has two id fields which REFERENCE data back at another table. It's setup like this: class_prerequisite_bindings(id SERIAL, class_id INTEGER REFERENCES classes(id), prerequisiteINTEGER REFERENCES classes(id)) The classes table is like this: classes(idSE

[SQL] showing multiple reference details from single query

2005-09-11 Thread Ferindo Middleton Jr
I have a table (table_one) with two columns, both of which are integers which reference the same column (on a one-to-many relationship) row back at another table (table_two) which has more detailed info on these integer columns: table_one has the following columns: id (SERIAL), column_one (INT

Re: [SQL] How to secure PostgreSQL Data for distribute?

2005-08-18 Thread Ferindo Middleton Jr
On 8/17/05, Premsun Choltanwanich <[EMAIL PROTECTED]> wrote: Dear All, I need to distribute my application that use PostgreSQL as database to my customer. But I still have some questions in my mind on database security. I understand that everybody who get my application database will

Re: [SQL] incorrect syntax for 'plpgsql' function to test boolean

2005-08-06 Thread Ferindo Middleton Jr
Yeah, I guess so. I just didn't want the compiler to think I was trying to assign the value. And I also figured out that instead of the &&, I needed to just say AND Thanks. Ferindo John DeSoi wrote: On Aug 6, 2005, at 10:52 PM, Ferindo Middleton Jr wrote: ERR

[SQL] incorrect syntax for 'plpgsql' function to test boolean values

2005-08-06 Thread Ferindo Middleton Jr
I'm trying to write a function and trigger to validate that user data entry for boolean values makes sense before being inserted or updated into my database. I have the following trigger: CREATE TRIGGER trigger_registration_and_attendance BEFORE INSERT OR UPDATE ON registration_and_attendance F

[SQL] UPDATE/INSERT on multiple co-dependent tables

2004-11-13 Thread Ferindo Middleton Jr
ssary for backwards-compatibility -- www.sleekcollar.com Ferindo Middleton, Jr. Chief Architect Sleekcollar Internet Application & Artistic Visualizations [EMAIL PROTECTED]

[SQL] UPDATE/INSERT on multiple co-dependent tables

2004-11-09 Thread Ferindo Middleton, Jr
Is it possible for an UPDATE/INSERT query string to function in such a way that it requires two like fields in different tables to be equal to/'in sync with' one another: Example: I have two tables: registration & schedules they both record a class_id, start_date, end_date... I want to make su

[SQL] Insert/Update Perl Function involving two tables needing to by 'in sync'

2004-11-02 Thread Ferindo Middleton Jr
I am trying to write a Perl Function for one of the databases I'm building a web application for. This function is triggered to occur BEFORE INSERT OR UPDATE. This function is complex in that it involves fields in two different tables which need to be updated, where the updates one receives depend