I have a table that contains an array of ints (we'll call it lineTable). That array of int's represents an array of unique id's in another table (pointTable). The point table in turn contains 3 columns (id, x, y).
I want to be able to convert each one of those ints in the lineTable.points to an array of of array of ints.
lineTable pointTable
| id | points | | id | x | y |
| int| int[] | | int|int|int|
lineTable
| 1 | {1, 2, 3, 4, 5} |
| 2 | {4, 7, 5, 2, 3} |
| 3 | {8, 1} |
etc
pointTable
| 1 | 1 | 0 |
| 2 | 2 | 1 |
| 3 | 5 | 6 |
| 4 | 7 | 0 |
| 5 | 2 | 4 |
| 6 | 5 | 2 |
| 7 | 4 | 4 |
| 8 | 5 | 9 |
So what I want the eventual output to be would be
lineValues
| {{1, 0}, {2, 1}, {5, 6}, {7, 0}, {2, 4}} |
| {{7, 0}, {4, 4}, {2, 4}, {2, 1}, {5, 6}} |
| {{5, 9}, {1, 0}} |
Note: The ID's can be any number and are not in a sequential pattern (it may go 1, 2, 5, 10, 11, 18)
I am using Postgre 9.2.
Thank You for any assistance. Let me know if you need/want any other information.