Re: [HACKERS] array manipulations

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Blazso <blazso(at)deltav(dot)hu>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] array manipulations
Date: 1999-09-04 15:08:23
Message-ID: 24067.936457703@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Blazso <blazso(at)deltav(dot)hu> writes:
> If you are interested, I could extend its functionality to other types
> as well and send this small pack to you. For this, however I should know
> more about how Postgres manages types internally...

I think it should be possible to make a type-independent version of that
code, and if you want to do so it'd be a great extension.

How does it look to the user? Something like

UPDATE table SET arrayfield = arrayInsert(arrayfield, index, newval)

UPDATE table SET arrayfield = arrayDelete(arrayfield, index)

I suppose? What do you do about multi-dimensional arrays?

One thing a number of people have complained about is that the natural
way to extend an array is

UPDATE table SET arrayfield[n+1] = newval

if arrayfield currently has n entries. The array assignment code ought
to handle this case but doesn't. I don't think it would be a huge fix
but I haven't looked at the code enough to understand what would need
to change.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-09-04 15:18:06 Re: [HACKERS] PostgreSQL 6.5.1: libpq++ libraries on IRIX 6.5
Previous Message Bruce Momjian 1999-09-04 14:57:53 Re: [HACKERS] temp table oddness?