Re: Is This A Set Based Solution? - Mailing list pgsql-general

From Stefan Berglund
Subject Re: Is This A Set Based Solution?
Date
Msg-id kkj4v2510ku71ma0fmoptpdc5gppkcggop@4ax.com
Whole thread Raw
In response to Is This A Set Based Solution?  (Stefan Berglund <stefan_berglund@msn.com>)
Responses Re: Is This A Set Based Solution?
List pgsql-general
On Sat, 10 Mar 2007 00:37:08 -0500, tgl@sss.pgh.pa.us (Tom Lane) wrote:
 in <7887.1173505028@sss.pgh.pa.us>

>Stefan Berglund <stefan_berglund@msn.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

pgsql-general by date:

Previous
From: Sorin Schwimmer
Date:
Subject: Re: query ... returned 4 columns
Next
From: Stefan Berglund
Date:
Subject: Re: Is This A Set Based Solution?