Skip site navigation (1) Skip section navigation (2)

Array of C integers to temporary table?

From: postgres-novice(at)coreland(dot)ath(dot)cx
To: pgsql-novice(at)postgresql(dot)org
Subject: Array of C integers to temporary table?
Date: 2009-01-27 13:04:42
Message-ID: 20090127130442.GA58365@logik.internal.network (view raw or flat)
Thread:
Lists: pgsql-novice
Hello.

What's the "correct" (read: simple, efficient) way to
pass an arbitrarily sized array of C integers to postgres
and have it turned into a temporary table?

I'm using PostgreSQL 7.4.

I could, of course, turn the array into a long list of
insert statements:

  BEGIN;
  CREATE TEMPORARY TABLE temp_table (id integer) ON COMMIT DROP;
  INSERT INTO temp_table VALUES (1);
  INSERT INTO temp_table VALUES (23);
  INSERT INTO temp_table VALUES (3889);
  ...

But that seems long winded and rather inefficient.

Any help appreciated!


Responses

pgsql-novice by date

Next:From: LukasDate: 2009-01-27 14:03:47
Subject: Re: Select START and MAXVALUE from Sequence
Previous:From: A. KretschmerDate: 2009-01-27 10:49:11
Subject: Re: Select START and MAXVALUE from Sequence

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group