Re: [SQL] Scheduling Events?

2003-01-28 Thread Ed L.
On Thursday January 23 2003 5:16, David Durst wrote:
> Is there anyway to schedule DB Events based on time?

If you're using one of the unices (linux, etc.), how about...

crontab + perl + DBI + DBD::Pg?

or 

crontab + bash/sh + psql + pl/pgsql?

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [SQL] integrity of column used to order rows

2003-03-19 Thread Ed L.
On Wednesday March 19 2003 9:18, [EMAIL PROTECTED] wrote:
>
> What I want to be able to do is make sure that at all times the child
> records linked to a parent record have values for the "rank" field that
> are consecutive starting at 1, ie (1,2,4,5,6) not (1,2,4,5,7).
>
> Can someone offer the best suggestion to do this?

This is certainly possible via a triggered PL/pgSQL function.  Of course, 
whether or not it is feasible w/r/t performance or exactly how you choose 
to set the ranks depends on your context.  If you have appropriate indices 
on the foreign key to the parent table, the overall size of the table is 
probably irrelevant; use of the index would allow you to avoid traversal of 
the entire table.  You also have the option of writing the function in C to 
get better performance.

Ed



---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]