Database Reference
In-Depth Information
[5,7],[2,8],[10,4],[1,15],[4,9],[8,3],[5,3],[20,0]
(1 row)
Now,justtowrapthisresultinbracketsusetheconcatenationoperator || inorder
to append outside brackets, changing our last WITH statement to the following:
aggstring AS (
SELECT '[' || STRING_AGG(pstring, ',' ORDER
BY gid) || ']' AS inputtext
FROM endingbracket
)
SELECT * FROM aggstring;
You will get the following result:
inputtext
------------------------------------------------------
[[5,7],[2,8],[10,4],[1,15],[4,9],[8,3],[5,3],[20,0]]
(1 row)
Step two - returning results
Whew!Now,ourinputtextisproperlyformattedforourfunction.Letustryfeedingit
inandgettingresults,changingourfinal SELECT statementintheprecedingcodeto
feed our input text into our chp04.voronoi_fast function:
SELECT chp04.voronoi_fast(inputtext) FROM
aggstring;
The result is as follows:
Search WWH ::




Custom Search