PostgreSQL width() Function

The PostgreSQL width() function returns the horizontal width of the specified rectangle.

width() Syntax

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

width(box) -> double precision

Parameters

box

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

Return value

The PostgreSQL width() function returns the horizontal width of the specified rectangle.

width() Examples

The following statement shows how to use the PostgreSQL width() function to return horizontal width of the box '(1,1),(-1,-1)'.

SELECT width(box '(1,1),(-1,-1)');
 width
-------
     2