Re: insert into table from list or array ? - Mailing list pgsql-sql

From Viktor Bojović
Subject Re: insert into table from list or array ?
Date
Msg-id AANLkTikEr4KyOe3MgFAbJOCMXAPxdoq5Q9cz45yY1-sq@mail.gmail.com
Whole thread Raw
In response to insert into table from list or array ?  (Andreas <maps.on@gmx.net>)
List pgsql-sql
i think that you can try to 
create temporary table tmptable(id integer, numbers integer[]);
and
insert into table values (1,array[2, 3, 5, 7, 11, 13, 17, 19, 23, 31, 37, ...]);

On Mon, Oct 18, 2010 at 8:00 PM, Andreas <maps.on@gmx.net> wrote:
 Hi,

is it possible to insert into a table from list or an array ?

Suppose there is a set of numbers that might be IDs of tables within the DB.
To work with them I'd need a temporary table that just holds a single column with those numbers.
Something like

create temporary table tmptable as select id from
( 2, 3, 5, 7, 11, 13, 17, 19, 23, 31,
 37, ... );

would be great.

I get those numbers as textfile with 10 numbers per line and devided by comma+space as in the sample above, though the comma+space is negotiable if this were an issue.

:)

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



--
---------------------------------------
Viktor Bojović
---------------------------------------
Wherever I go, Murphy goes with me

pgsql-sql by date:

Previous
From: Andreas
Date:
Subject: insert into table from list or array ?
Next
From: Pavel Stehule
Date:
Subject: Re: insert into table from list or array ?