Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Adrian Klaver
On 09/03/2013 04:34 PM, Janek Sendrowski wrote: A loop through every input sentence FOR i IN 1..array_length(p_sentence, 1) LOOP FOR some_rec IN EXECUTE "SELECT * FROM table WHERE "Fulltextsearch statement" LOOP "Insert the current record data into the temp table" END LOOP; END

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Adrian Klaver
On 09/03/2013 04:34 PM, Janek Sendrowski wrote: A loop through every input sentence FOR i IN 1..array_length(p_sentence, 1) LOOP FOR some_rec IN EXECUTE "SELECT * FROM table WHERE "Fulltextsearch statement" LOOP "Insert the current record data into the temp table" END LOOP; END

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Adrian Klaver
On 09/03/2013 02:52 PM, Janek Sendrowski wrote: The links don't work. I don't know why. how just don't know how to insert the data of a record in a table The link I sent points to 39.6.4. Looping Through Query Results in the plpgsql documentation: http://www.postgresql.org/docs/9.2/interacti

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Janek Sendrowski
The links don't work. I don't know why. how just don't know how to insert the data of a record in a table

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Kevin Grittner
Janek Sendrowski wrote: > I just can't understabd why it's not possible to store multiple > columns returning from a dynamic Select statement which is > executet with EXECUTE into a temporary table. You can: CREATE TEMPORARY TABLE AS SELECT ... http://www.postgresql.org/docs/current/interactiv

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Adrian Klaver
On 09/03/2013 12:10 PM, Janek Sendrowski wrote: Thanks for the answers. I just can't understabd why it's not possible to store multiple columns returning from a dynamic Select statement which is executet with EXECUTE into a temporary table. If I'm gonna use the LOOP through the SELECT statement,

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Janek Sendrowski
Thanks for the answers. I just can't understabd why it's not possible to store multiple columns returning from a dynamic Select statement which is executet with EXECUTE into a temporary table. If I'm gonna use the LOOP through the SELECT statement, how can insert the data from the record into the

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-03 Thread Kevin Grittner
Pavel Stehule wrote: > PostgreSQL doesn't support a table variables Well, from a relational theory point of view, a variable which stores a relation is what a table *is*.  PostgreSQL attempts to store data for temporary tables in RAM and spill them to disk only as needed.  So IMO the response su

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-02 Thread Pavel Stehule
Hello PostgreSQL doesn't support a table variables, but you can use a arrays. postgres=# create table foo2(a int, b int); CREATE TABLE postgres=# insert into foo2 select i, i+1 from generate_series(1,4) g(i); INSERT 0 4 postgres=# select * from foo2; a | b ---+--- 1 | 2 2 | 3 3 | 4 4 | 5 (4

Re: [GENERAL] store multiple rows with the SELECT INTO statement

2013-09-01 Thread Adrian Klaver
On 09/01/2013 05:23 PM, Janek Sendrowski wrote: Hi, Why is it only possible to store one row by a query which returns multiple rows using the SELECT INTO statement. and How can I do a Query on a record varialbe, somehow like this: SELECT * FROM v_rec You can't a record variable can only hold a

[GENERAL] store multiple rows with the SELECT INTO statement

2013-09-01 Thread Janek Sendrowski
Hi,   Why is it only possible to store one row by a query which returns multiple rows using the SELECT INTO statement. and How can I do a Query on a record varialbe, somehow like this: SELECT * FROM v_rec   Janek Sendrowski