[SQL] subquery question

2009-03-12 Thread Sebastian Böhm
Hi, I have a table: (date timestamp, id integer, value integer) What Iam trying to do is to get a result that looks like this: day sum_oddsum_even 2009-01-01 656578867 2009-01-02 876785 87667 basically a need to combine these two queries into one: SELECT

[SQL] reliable lock inside stored procedure

2008-11-03 Thread Sebastian Böhm
Hi, I have a stored procedure and I need a SHARE ROW EXCLUSIVE lock in this procedure (otherwise data will get corrupted). According to the documentation the LOCK statement is useless and will silently fail if not executed inside a transaction. (btw: this sounds dangerous to me) Also

Re: [SQL] reliable lock inside stored procedure (SOLVED)

2008-11-03 Thread Sebastian Böhm
Hi Richard, thank you for your answer! Am 03.11.2008 um 12:06 schrieb Richard Huxton: Sebastian Böhm wrote: Hi, I have a stored procedure and I need a SHARE ROW EXCLUSIVE lock in this procedure (otherwise data will get corrupted). OK. PostgreSQL doesn't have stored procedures so I