Re: [SQL] concurrency problem

2006-06-17 Thread Ash Grove
Locks are released when the containing transaction commits. There is no explicit "release." Instead of calling "begin" and "commit" as statements, I do something more like below. As Aaron mentioned, this is JDBC, not SQL. Sorry people. try { ... conn.setAutoCommit(false); //do the insert on

[SQL] any additional date_time functions?

2006-06-17 Thread Richard Broersma Jr
I am working with the date_trunc() function with great success especially in the group by clause for aggregates. However, it is limited to returning "WHOLE" time units. i.e. years, months, days, hours, minutes, seconds. Are there any functions similar to date_trunc that can return variable inc

Re: [SQL] concurrency problem

2006-06-17 Thread Aaron Bono
When in this situation I:1. Wait until I have enough data to do a complete commit before even bothering to save any data to the database.  I want the life of my transactions to last no more than milliseconds if possible. 2. Use a BIGSERIAL for the primary keys so the IDs are assigned automatically

Re: [SQL] keeping last 30 entries of a log table

2006-06-17 Thread Daniel CAUNE
> I need to write a function which inserts a log entry in a log table and > only > keeps the last 30 records. I was thinking of using a subquery similar to > the > following: > > insert into log (account_id, message) values (1, 'this is a test); > delete from log where account_id = 1 and id not i