Re: Alter table with arrays

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: igor <igor_kh(at)mailru(dot)com>
Cc: pgsql-novice(at)postgreSQL(dot)org
Subject: Re: Alter table with arrays
Date: 2000-07-24 16:41:34
Message-ID: 635.964456894@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice pgsql-sql

igor <igor_kh(at)mailru(dot)com> writes:
> Help me please to alter table with arrays .
> And now I would like to increase the number of colomns of array from
> two to tree. What is the way to fulfill these operation?

As of 7.0.*, the only way to change the size of an array is to replace
the whole array, ie,
UPDATE table SET arraycol = '{ .... }'

I have recently fixed the array code so that you can enlarge an array
by assigning to an element or slice. For example, given an array with
current dimensions [1:3] you can assign to array[4] (or array[0], or
array[2:7], etc). Restriction: you can't leave "holes" in the array,
so it only works for 1-D arrays. This will appear in 7.1.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-07-24 16:43:14 Re: Multithreaded libpq?
Previous Message Jeffrey A. Rhines 2000-07-24 16:24:15 PostgreSQL, ODBC, Access

Browse pgsql-novice by date

  From Date Subject
Next Message Andrew McMillan 2000-07-24 20:29:50 Re: Finding Tables
Previous Message Martin Christensen 2000-07-24 14:03:21 Searching BLOBs

Browse pgsql-sql by date

  From Date Subject
Next Message Kyle 2000-07-24 17:00:06 TCL updates
Previous Message Kyle 2000-07-24 16:30:25 altering column constraints