integer[] Update Questions

From: Ryan Mahoney <ryan(at)paymentalliance(dot)net>
To: pgsql-hackers(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org, oleg(at)sai(dot)msu(dot)su, teodor(at)stack(dot)net
Subject: integer[] Update Questions
Date: 2002-08-23 14:39:42
Message-ID: 1030113582.31478.127.camel@dhcp-224-12
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Greeting Hackers! Had some questions about integer array type...

If I have a integer[] field in a table, which already has the values
{1,2,3,6,17} and I additionally want to add the value '45' to this
array, is there any easier way than SELECTing the current values and
then updating the entire record?

I see that I could do:
UPDATE table SET array_field[6] = 45 WHERE ...

But how do I know that 6 is the correct index without first SELECTing
all the data?

Is there an array push/pop function? Is there a method of counting the
number of integers in an array?

Thanks for any help you can provide - indexable integer arrays are an
incredible feature, thanks for the hard work!

Ryan Mahoney

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Klimov 2002-08-23 14:46:30 TCL RPM for Windows
Previous Message Darren Ferguson 2002-08-23 14:28:44 Re: How to retrieve a comment/description from a table

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-08-23 15:24:19 Re: Proposed GUC Variable
Previous Message Chris Humphries 2002-08-23 13:24:22 Re: v7.2.2 packaged ...