On Sat, 10 Mar 2007 00:37:08 -0500, tgl@xxxxxxxxxxxxx (Tom Lane) wrote: in <7887.1173505028@xxxxxxxxxxxxx> >Stefan Berglund <stefan_berglund@xxxxxxx> 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