pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Alter table with arrays
2+ messages / 2 participants
[nested] [flat]

* Alter table with arrays
@ 2000-07-24 13:54  igor <igor_kh@mailru.com>
  0 siblings, 1 reply; 2+ messages in thread

From: igor @ 2000-07-24 13:54 UTC (permalink / raw)
  To: pgsql-novice@postgresql.org

Hi !

 Help me please to alter table with arrays .
The table was created :

create stat (st char(20), stv float[][], str float[][]);

Usualy  I add new row as follow:

insert into stat
select '4090903' as st,
'{{0,0,0,0,0,0},{0,0,0,0,0,0}}' as str,
'{{0,0,0,0,0,0},{0,0,0,0,0,0}}' as stv ;

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?


Thanks .

Igor





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Alter table with arrays
@ 2000-07-24 16:41  Tom Lane <tgl@sss.pgh.pa.us>
  parent: igor <igor_kh@mailru.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2000-07-24 16:41 UTC (permalink / raw)
  To: igor <igor_kh@mailru.com>; +Cc: pgsql-novice@postgreSQL.org

igor <igor_kh@mailru.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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-07-24 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-24 13:54 Alter table with arrays igor <igor_kh@mailru.com>
2000-07-24 16:41 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox