[SQL] plpgsql loop question

2010-02-10 Thread Andrea Visinoni
hi, i have a table called zones: idzone, zone_name and several tables called zonename_records (same structure), where zonename is one of the zone_name in the zones table. What i want to do is a function that union all of this tables dinamically based on zones table, this is what i've done so

Re: [SQL] plpgsql loop question

2010-02-10 Thread Justin Graf
On 2/10/2010 11:29 AM, Andrea Visinoni wrote: hi, i have a table called zones: idzone, zone_name and several tables called zonename_records (same structure), where zonename is one of the zone_name in the zones table. What i want to do is a function that union all of this tables dinamically

Re: [SQL] plpgsql loop question

2010-02-10 Thread Adrian Klaver
On 02/10/2010 08:29 AM, Andrea Visinoni wrote: hi, i have a table called zones: idzone, zone_name and several tables called zonename_records (same structure), where zonename is one of the zone_name in the zones table. What i want to do is a function that union all of this tables dinamically

Re: [SQL] For loop

2007-03-13 Thread Ezequias R. da Rocha
I tryed a way but it is not working. Please see it: LOOP; -- some computations insert into carga (desc) values ('My Text'); IF count 100 THEN EXIT; -- exit loop END IF; END LOOP; The postgresql reports the following error: / ERROR: syntax error at or near LOOP SQL state

Re: [SQL] For loop

2007-03-13 Thread Bart Degryse
100 THEN EXIT; -- exit loop END IF; END LOOP; The postgresql reports the following error: / ERROR: syntax error at or near LOOP SQL state: 42601 Character: 1/ ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ

Re: [SQL] For loop

2007-03-13 Thread Ezequias R. da Rocha
They are not working well. Allways the same error. (if while) ERROR: syntax error at or near WHILE SQL state: 42601 Character: 1 (if for) ERROR: syntax error at or near FOR SQL state: 42601 Character: 1 (if loop) ERROR: syntax error at or near LOOP SQL state: 42601 Character: 1 I installed

Re: [SQL] For loop

2007-03-13 Thread Bart Degryse
] 2007-03-13 14:19 They are not working well. Allways the same error. (if while) ERROR: syntax error at or near WHILE SQL state: 42601 Character: 1 (if for) ERROR: syntax error at or near FOR SQL state: 42601 Character: 1 (if loop) ERROR: syntax error at or near LOOP SQL state: 42601 Character

Re: [SQL] For loop

2007-03-13 Thread Alvaro Herrera
Ezequias R. da Rocha wrote: They are not working well. Allways the same error. (if while) ERROR: syntax error at or near WHILE SQL state: 42601 Character: 1 You may have a problem in the code just _before_ these lines. -- Alvaro Herrera

Re: [SQL] For loop

2007-03-13 Thread Adrian Klaver
: syntax error at or near LOOP SQL state: 42601 Character: 1 I installed the pgsql but I don't think it is a problem of language. What could be wrong ? I am not using functions too. I am using the SQL tool of PgAdmin III. Any help would be glad. Can we see the complete function? -- Adrian

Re: [SQL] For loop

2007-03-13 Thread Ezequias R. da Rocha
SQL state: 42601 Character: 1 (if for) ERROR: syntax error at or near FOR SQL state: 42601 Character: 1 (if loop) ERROR: syntax error at or near LOOP SQL state: 42601 Character: 1 I installed the pgsql but I don't think it is a problem of language. What could be wrong ? I am not using functions

Re: [SQL] For loop

2007-03-13 Thread Jonah H. Harris
On 3/13/07, Ezequias R. da Rocha [EMAIL PROTECTED] wrote: I quetion one more time. I must have a function ? Isn't another way to implement it without using functions ? Not in PostgreSQL. Here's a sample of something similar to what you were doing. CREATE LANGUAGE plpgsql; CREATE TABLE carga

Re: [SQL] For loop

2007-03-13 Thread Bart Degryse
(if for) ERROR: syntax error at or near FOR SQL state: 42601 Character: 1 (if loop) ERROR: syntax error at or near LOOP SQL state: 42601 Character: 1 I installed the pgsql but I don't think it is a problem of language. What could be wrong ? I am not using functions too. I am using the SQL tool

Re: [SQL] For loop

2007-03-13 Thread A. Kretschmer
am Tue, dem 13.03.2007, um 10:30:59 -0300 mailte Ezequias R. da Rocha folgendes: I quetion one more time. I must have a function ? Isn't another way to implement it without using functions ? Yes, you need a function. SQL doesn't know LOOPs. And, please, no silly fullquote. [100 lines

[SQL] For loop

2007-03-13 Thread Ezequias R. da Rocha
Hi list, I would like to test the power of processing of postgresql (and my server) by insert a large ammount of data on a table I have. I would like to know how to implement a For... loop . With it I think I could check the real power of my server. Ezequias

Re: [SQL] For loop

2007-03-13 Thread Alvaro Herrera
Ezequias R. da Rocha wrote: Thank you all. The function from Jonah solves my problem. Just a simple question: One million of inserctions in *28,8* seconds with this kind of data (timestamp|character varring (50)) is a good performance ? I let my questions to DBAs from PostgreSQL. I

Re: [SQL] For loop

2007-03-13 Thread Ezequias R. da Rocha
I rewritte the Jonah's function to: FOR iter IN 1 .. num_iter LOOP -- some computations INSERT INTO carga (descricao) VALUES ('CardPass'); END LOOP; My ID is now() by default And it was in 23sec After I changed the insert to: INSERT INTO carga (id,descricao) VALUES

[SQL] Infinite loop crashes server

2003-11-28 Thread George A.J
hi all, i am using PostgreSQL 7.3.2 on redhat linux 9. there is problem when executing pl/pg sql functions. if the function enter an infinite loop. the server is hanged. cannot cancel the query. the linux itself is hanged.i cannot kill postgres process. i have to reboot the machine manually..