From: | Stefan Berglund <sorry(dot)no(dot)koolaid(at)for(dot)me> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Is This A Set Based Solution? |
Date: | 2007-03-10 06:24:04 |
Message-ID: | kkj4v2510ku71ma0fmoptpdc5gppkcggop@4ax.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, 10 Mar 2007 00:37:08 -0500, tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane) wrote:
in <7887(dot)1173505028(at)sss(dot)pgh(dot)pa(dot)us>
>Stefan Berglund <stefan_berglund(at)msn(dot)com> writes:
>> Below is a small test case that illustrates what I'm attempting which is
>> to provide a comma separated list of numbers to a procedure which
>> subsequently uses this list in a join with another table.
>
>> My questions are is this a set based solution and is this the best
>> approach in terms of using the data types and methods afforded by
>> PostgreSQL? I'm mostly inquiring about the double FOR loop which just
>> doesn't feel right to me ...
>
>It looks pretty ugly to me too, but you haven't explained your problem
>clearly enough for anyone to be able to recommend a better solution path.
>Why do you feel you need to do this? What is the context?
I've been lurking for several thousand posts and I'm flattered that
you've responded but I'm also a little flustered that I failed to
communicate so I'll try again.
In SQL Server I was able to pass a string of IDs such as '1,5,3' to a
procedure that would create a set of tuples where each tuple was one of
those ids:
Row 1 : 1
Row 2: 5
Row 3: 3
I could then use this table in a join with another table.
What I want to do is to create a function that takes a comma separated
string of numbers and produces a table (where each row is one of those
numbers) that can be joined to other tables as in the example first
provided.
fn_Split_List is supposed to take a list of numbers and return a table
of rows of those numbers.
I hope this better explains what I'm trying to do but somehow from your
reaction I get the feeling that I'm missing something really basic?
---
This posting is provided "AS IS" with no warranties and no guarantees either express or implied.
Stefan Berglund
From | Date | Subject | |
---|---|---|---|
Next Message | Stefan Berglund | 2007-03-10 06:32:58 | Re: Is This A Set Based Solution? |
Previous Message | Tom Lane | 2007-03-10 06:01:27 | Re: Moving from 32 to 64 bit builds on Solaris |