[SQL] exception handling and CONTINUE

2008-07-08 Thread Marcin Krawczyk
Hi all. Can anyone tell me if there's a way to use CONTINUE clause outside the loop ? An example : FOR a IN SELECT * FROM xxx LOOP INSERT INTO yyy VALUES (a.***, ..) END LOOP; EXCEPTION WHEN unique_violation THEN CONTINUE; I get an error saying I can't use CONTINUE outside of a loop. Is there

Re: [SQL] exception handling and CONTINUE

2008-07-08 Thread Alvaro Herrera
Marcin Krawczyk escribió: Hi all. Can anyone tell me if there's a way to use CONTINUE clause outside the loop ? An example : FOR a IN SELECT * FROM xxx LOOP INSERT INTO yyy VALUES (a.***, ..) END LOOP; EXCEPTION WHEN unique_violation THEN CONTINUE; Try something like this: for a

Re: [SQL] exception handling and CONTINUE

2008-07-08 Thread Pavel Stehule
no, you can use CONTINUE only in loop. When you wont ignore exception, just do nothing For example, the following two fragments of code are equivalent: BEGIN y := x / 0; EXCEPTION WHEN division_by_zero THEN NULL; -- ignore the error END; BEGIN

Re: [SQL] how to control the execution plan ?

2008-07-08 Thread Sabin Coanda
Hi Scott, I add the answers below. Just wondering what the query plans look like here, both regular explain, and if you can wait for it to execute, explain analyze. Just with explain, because the function craches when it is running: Merge Join (cost=141.41..188.32 rows=1 width=24) Merge

Re: [SQL] exception handling and CONTINUE

2008-07-08 Thread Marcin Krawczyk
Thank you guys. Alvaro your idea works tha way I wanted. Why didn't I think about it ? :) regards mk

[SQL] Best practice for long-lived journal tables: bigint or recycling IDs?

2008-07-08 Thread Mark Stosberg
Hello, I have some tables that continually collect statistics, and then over time are pruned as the stats are aggregated into more useful formats. For some of these tables, it it is fore-seeable that the associated sequences would be incremented past the max value of the int type in the normal

Re: [SQL] Best practice for long-lived journal tables: bigint or recycling IDs?

2008-07-08 Thread Alvaro Herrera
Mark Stosberg wrote: Hello, I have some tables that continually collect statistics, and then over time are pruned as the stats are aggregated into more useful formats. For some of these tables, it it is fore-seeable that the associated sequences would be incremented past the max value

[SQL] Re: Best practice for long-lived journal tables: bigint or recycling IDs?

2008-07-08 Thread Mark Stosberg
On Tue, 8 Jul 2008 17:20:13 -0400 Alvaro Herrera [EMAIL PROTECTED] wrote: Mark Stosberg wrote: Hello, I have some tables that continually collect statistics, and then over time are pruned as the stats are aggregated into more useful formats. For some of these tables, it it

Re: [SQL] Re: Best practice for long-lived journal tables: bigint or recycling IDs?

2008-07-08 Thread Alvaro Herrera
Mark Stosberg wrote: On Tue, 8 Jul 2008 17:20:13 -0400 Alvaro Herrera [EMAIL PROTECTED] wrote: 3. Deal with wraparound by ensuring that the applications behave sanely Wrap-around? Exceeding the max size of int looks more like a brick wall than wrap-around to me: insert into t