From: | Lee Hughes <lee(at)hughesys(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Convert Arbitrary Table to Array? |
Date: | 2009-02-09 18:14:18 |
Message-ID: | 2d739b560902091014i1f11f04dhfee7a29fea13d720@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Good point on scalability -- I am planning to limit the number of rows
fetched through LIMIT or a Cursor once I have the basics working.
Did you mean *select array(select * from mytable);* ?
Thanks for your help, I will try this approach.
Lee
On Mon, Feb 9, 2009 at 9:20 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Lee Hughes <lee(at)hughesys(dot)com> writes:
> > Hi, I need a function that accepts a table name and returns a
> 2-dimensional
> > array of the table data.
>
> Well, in 8.3 and up there are arrays of composite types, so you can
> do something like
>
> select array(select mytable from mytable);
>
> However you are not going to be able to encapsulate that as a function
> real well, because of the question of what is the function's result
> type.
>
> You should also realize that this approach is not going to scale to
> large tables. You don't want to get into pushing around arrays of more
> than say a couple of megabytes.
>
> Personally I'd be wondering exactly where this requirement comes from
> and whether it doesn't betoken severe database-ignorance in the
> application design.
>
> regards, tom lane
>
--
Lee
503-753-7620
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-02-09 18:25:54 | Re: Convert Arbitrary Table to Array? |
Previous Message | Steve Crawford | 2009-02-09 18:10:08 | Re: Pet Peeves? |