PostgreSQL pclose() Function

The PostgreSQL pclose() function converts the specified path to a closed path.

pclose() Syntax

This is the syntax of the PostgreSQL pclose() function:

pclose(path) -> path

Parameters

path

Required. A path. For example: path '[(0,0),(1,1),(2,0)]'.

Return value

The PostgreSQL pclose() function returns the closed form of the path specified by the argument. If the path specified by the parameter is a closed path, the original path is returned.

pclose() Examples

The following statement shows how to use the PostgreSQL pclose() function to convert a path path '[(0,0),(1,1),(2,0)]' to its closed form.

SELECT pclose(path '[(0,0),(1,1),(2,0)]');
       pclose
---------------------
 ((0,0),(1,1),(2,0))

The following statement shows how to use the PostgreSQL pclose() function to convert a path path '((0,0),(1,1),(2,0))' to its closed form.

SELECT pclose(path '((0,0),(1,1),(2,0))');
       pclose
---------------------
 ((0,0),(1,1),(2,0))

Here, because path '((0,0),(1,1),(2,0))' is closed, itself is returned.