PostgreSQL lseg(box) Function

The PostgreSQL lseg(box) function extracts the diagonal of the specified rectangle and returns it as a line segment.

lseg(box) Syntax

This is the syntax of the PostgreSQL lseg(box) function:

lseg(box) -> lseg

Parameters

box

Required. A rectangle. For example: box '(1,1),(0,0)'.

Return value

The PostgreSQL lseg(box) function extracts the diagonal of the specified rectangle and returns it as a line segment.

lseg(box) Examples

The following statement shows how to use the PostgreSQL lseg(box) function to extract the diagonal of a rectangle as a line segment.

SELECT lseg(box '(1,1),(0,0)');
     lseg
---------------
 [(1,1),(0,0)]