Re: [SQL] passing values into .sql scripts

2005-09-15 Thread Geoffrey Knauth
That did exactly what I wanted. Thank you! (I had tried \set acct ... before, but it was your quoting that fixed my problem.) Geoffrey -- Geoffrey S. Knauth | http://knauth.org/gsk On Sep 15, 2005, at 18:43, Michael Fuhr wrote: What's your intention here? The above sets the variable tmp

Re: [SQL] passing values into .sql scripts

2005-09-15 Thread Michael Fuhr
On Thu, Sep 15, 2005 at 05:27:52PM -0400, Geoffrey Knauth wrote: > I want to do something like this: > > \set tmp :acct 'a value' What's your intention here? The above sets the variable tmp to the value of the variable acct concatenated with 'a value', but you don't show acct being set anywh

[SQL] How to install Postgresql 8 on different drive letter?

2005-09-15 Thread The One
Hi,   I downloaded postgresql 8.0 MSI.  How can I tell postgresql to install on a different drive letter?   Thank you Yahoo! for Good Click here to donate to the Hurricane Katrina relief effort.

[SQL] passing values into .sql scripts

2005-09-15 Thread Geoffrey Knauth
I want to do something like this: \set tmp :acct 'a value' \i query.sql where query.sql looks like this: select sum(amount), dr_acct from ledger where dr_acct = :acct group by dr_acct; select sum(amount), cr_acct from ledger where cr_acct = :acct group by cr_acct; selec

Re: [SQL] Triggers & Conditional Assignment

2005-09-15 Thread Tom Lane
Neil Saunders <[EMAIL PROTECTED]> writes: > I've tried to write something along the lines of the following: > sdate = (NEW.start_date IS NOT NULL) ? NEW.start_date : OLD.start_date; > edate = (NEW.end_date IS NOT NULL) ? NEW.end_date : OLD.end_date; > But conditional assignment doesn't se

Re: [SQL] showing multiple REFERENCE details of id fields in single

2005-09-15 Thread Daryl Richter
Ferindo Middleton Jr wrote: 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 li

Re: [SQL] Triggers & Conditional Assignment

2005-09-15 Thread Gnanavel S
coalesce(NEW.end_date , OLD.end_date) will solve the issue.On 9/15/05, Neil Saunders <[EMAIL PROTECTED] > wrote:Hi,I've run in to a small problem when writing a trigger. For simplicities sake lets say that I have 2 tables – 'bookings' and'unavailable_periods'. Both have columns 'start_date','end_da

[SQL] Triggers & Conditional Assignment

2005-09-15 Thread Neil Saunders
Hi, I've run in to a small problem when writing a trigger. For simplicities sake lets say that I have 2 tables – 'bookings' and 'unavailable_periods'. Both have columns 'start_date','end_date', and 'property_id'. I have written a trigger that is fired on inserts and updates for both tables that