Re: plpgsql multidimensional array assignment results in array of text instead of subarrays

From: Michael Rasmussen <michaelr(at)porch(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: plpgsql multidimensional array assignment results in array of text instead of subarrays
Date: 2015-12-28 23:59:55
Message-ID: D32BBA79-54D1-44E3-8DCD-F3FEFA1FA386@porch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you all for your help.

I currently only have the two cases to handle, so I went with the below if-else statement which works how I expected.

-- Generate array of tables to create
if (create_source) then
the_tables := array[[new_table_schema, new_table_name],[new_table_schema||'_source', new_table_name||'_source']];
else
the_tables := array[[new_table_schema, new_table_name]];
end if;

--
Michael Rasmussen

Sr. Data Engineer
Porch

On 12/28/15, 3:51 PM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

>"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
>> ​or a more semantically meaning one...the use of the inner array is
>> arguably a hack here meant to avoid the overhead and new type creation by
>> assigning meaning to array slots.
>
>Yeah, good point: it looks like Mike does not consider the columns of
>the array to be interchangeable at all, so really he would be better
>off modeling the data as you suggest.
>
> regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hiroyuki Sato 2015-12-29 15:11:00 Re: grep -f keyword data query
Previous Message Tom Lane 2015-12-28 23:51:50 Re: plpgsql multidimensional array assignment results in array of text instead of subarrays