Copying data from int column to array column

From: Adam Witney <awitney(at)sgul(dot)ac(dot)uk>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Copying data from int column to array column
Date: 2005-06-08 12:21:19
Message-ID: BECCA14F.47523%awitney@sgul.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi,

I am trying to copy the data from an integer column into an array column in
the same table. Something like this

CREATE TABLE test (field1 INT, field2 INT, field3 INT[]);

INSERT INTO test VALUES(1);
INSERT INTO test VALUES(2);
INSERT INTO test VALUES(3);
INSERT INTO test VALUES(4);
INSERT INTO test VALUES(5);

UPDATE test SET field2 = field1;
UPDATE test SET field3[1] = field1;

Why does the UPDATE of field2 work, but the UPDATE of field3 does not?

Thanks for any help

Adam

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sean Davis 2005-06-08 12:44:59 Re: Copying data from int column to array column
Previous Message John DeSoi 2005-06-08 11:44:44 Re: Where to find translation of Postgres error messages?