Unix Technical Forum

Re: working with multidimensional arrays in plpgsql

This is a discussion on Re: working with multidimensional arrays in plpgsql within the pgsql Sql forums, part of the PostgreSQL category; --> Sibtay Abbas wrote: > hello everyone > > i am having problem with multidimensional arrays in plpgsql following > ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Sql

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 10:53 AM
Richard Huxton
 
Posts: n/a
Default Re: working with multidimensional arrays in plpgsql

Sibtay Abbas wrote:
> hello everyone
>
> i am having problem with multidimensional arrays in plpgsql following
> is the source code of the function which i am trying to run



> DECLARE
> x INTEGER[10][10];


> x[3][1] := '20'; ------i have even tried x[3][1] = 20


> As you might have observed here, the actual problem is
> how to do assignment to multidimensional array locations using the
> subscript operater.


Actually, the problem is that the array "x" has been initialised to
NULL. Therefore, you can't set individual values. Try a line like:
x := '{}';

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 10:53 AM
Sibtay Abbas
 
Posts: n/a
Default Re: working with multidimensional arrays in plpgsql

thank you very much for your reply
I did as you specified and it worked fine
thankz


On Wed, 26 Jan 2005 09:29:53 +0000, Richard Huxton <dev@archonet.com> wrote:
> Sibtay Abbas wrote:
> > hello everyone
> >
> > i am having problem with multidimensional arrays in plpgsql following
> > is the source code of the function which i am trying to run

>
>
> > DECLARE
> > x INTEGER[10][10];

>
> > x[3][1] := '20'; ------i have even tried x[3][1] = 20

>
> > As you might have observed here, the actual problem is
> > how to do assignment to multidimensional array locations using the
> > subscript operater.

>
> Actually, the problem is that the array "x" has been initialised to
> NULL. Therefore, you can't set individual values. Try a line like:
> x := '{}';
>
> --
> Richard Huxton
> Archonet Ltd
>


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:55 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com