How to insert columns into an array

From: Dirk Lutzebaeck <lutzeb(at)cs(dot)tu-berlin(dot)de>
To: pgsql-sql(at)postgreSQL(dot)org
Subject: How to insert columns into an array
Date: 1998-05-28 15:15:53
Message-ID: 13677.32264.100233.239282@gate.wadk-berlin.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Hi,

say you have the following two tables

CREATE TABLE t1 (
a TEXT,
b TEXT,
c TEXT);

CREATE TABLE t2 (
x TEXT[];
);

how can I insert a into x[0], b into x[1] and c into x[2]??? and how
about the other way round?

something like

insert into t2(x[0], x[1], x[2]) select * from t1;

fails.

Thanks for help,

Dirk

Browse pgsql-sql by date

  From Date Subject
Next Message M Simms 1998-05-28 18:43:32 subscribe pgsql-sql
Previous Message Jerome ALET 1998-05-28 14:55:52 Re: [SQL] nextval