Re: [SQL] Problem calling stored procedure

2005-08-23 Thread neil.saunders
Ok, the whole thing is done and dusted - Thank you everybody for your input. Apologies if I sometimes missed the obvious. For the sake of anyone having the same problems and happens across this post, I learned that: - The result of a cursor assignment cannot be row counted, unless you iterate thro

Re: [SQL] Problem calling stored procedure

2005-08-23 Thread neil.saunders
Just a quick addendum; I'm finding the number of rows by using GET DIAGNOSTICS num_entries = ROW_COUNT after I open the query, and then branching depending on this value - Is there any issue with using this in conjunction with cursors and OPEN FOR SELECT? I've just tried using OPEN FOR EXECUTE

Re: [SQL] Problem calling stored procedure

2005-08-23 Thread neil.saunders
Hi Tom, Thanks for the advice; But I'm still can't get it working. I only have three variables: prop_id, new_start_date, new_end_date, and into_table. I've used the regclass type, and I've tried changing new_start_date and new_end_date to nsd and ned respectively, but still no luck. If there a

[SQL] Tuple insert missing query in ongoing transaction

2005-08-23 Thread Szűcs Gábor
Dear Gurus, I know this is the typical case of transaction use, I just seem to lack the appropriate education of what exactly happens and whether I may be able to detect it. I have two queries, one affecting the other. 1. INSERT INTO barcode. A BEFORE INSERT/UPDATE trigger checks if there's

Re: [SQL] Problem calling stored procedure

2005-08-23 Thread Tom Lane
<[EMAIL PROTECTED]> writes: > OPEN cur_overlap FOR SELECT *, pg_class.RELNAME AS table FROM > calendar_entries WHERE (start_date, end_date) OVERLAP (new_start_date, > new_end_date) AND property_id = X AND pg_class.oid = tableoid; > The only thing I can think of is that when the query runs in the

Re: [SQL] Problem calling stored procedure

2005-08-23 Thread neil.saunders
Thank you everybody for your help - You were indeed correct - Removing the DATE worked, and ran the function from the client (Although now it fails in the debugger). I'm a little concerned why this didn't work in EMS PostgreSQL Manager debugger - I'll raise a bug tracker regarding this. However

Re: [SQL] diary constraints

2005-08-23 Thread A. Kretschmer
am 23.08.2005, um 9:33:58 +0100 mailte Gary Stainburn folgendes: > Hi folks > > I know this has been discussed in the past, but no amount of keywords > has returned anything from the archives. > > I want to create a courtesy car diary diary system where I have a table > containing all of the

Re: [SQL] diary constraints

2005-08-23 Thread PFC
a) the finish is after the start well, finish > start b) two allocations for a single vehicle don't overlap. this one is a bit tricky ! - Check that there is no allocation in the table whose time period start, end includes either the start of the end of the reservation to insert, and

Re: [SQL] diary constraints

2005-08-23 Thread Michael Glaesemann
On Aug 23, 2005, at 5:33 PM, Gary Stainburn wrote: I want to create a courtesy car diary diary system where I have a table containing all of the cortesy cars in the pool, and then an allocation table which has two timestamps, one for the start date/time and one for the return date/time. H

Re: [SQL] diary constraints

2005-08-23 Thread Gnanavel S
On 8/23/05, Gary Stainburn <[EMAIL PROTECTED]> wrote: Hi folksI know this has been discussed in the past, but no amount of keywordshas returned anything from the archives.I want to create a courtesy car diary diary system where I have a tablecontaining all of the cortesy cars in the pool, and then

Re: [SQL] diary constraints

2005-08-23 Thread neil.saunders
Hi Gary, I've actually just done the same thing - but for renting property. I've implemented the constraint as a trigger (Before insert/update, for each row), that first checks if the start_date is < end_date, and then performs a select on the bookings table using the OVERLAPS function. If the

[SQL] diary constraints

2005-08-23 Thread Gary Stainburn
Hi folks I know this has been discussed in the past, but no amount of keywords has returned anything from the archives. I want to create a courtesy car diary diary system where I have a table containing all of the cortesy cars in the pool, and then an allocation table which has two timestamps,