Data Types(2)
Tags: beginners, discuss, opengauss
Published: 2023-03-02 08:40:51

**Binary Types**

Table 8 lists the binary data types supported by openGauss.

Table 8 Binary data types

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ihqrgbsj63upbpxy9vg1.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1b138h30lb9eo5wv676k.png)

**Date/Time Types**

Table 9 lists the date/time types supported by openGauss.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a8m66n3eav333ldmgmly.png)

Table 9 Date/Time types

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ul5lvxk5e1tzwx3whqit.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4sblulnmh268m767suaa.png)

**Geometric Types**

Table 10 lists the geometric types that can be used in openGauss. The most basic type is point which forms the basis for all of the other types.

Table 10 Geometric types

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ecqkbu9iqdw8qqz98cah.png)

A rich set of functions and operators is available in openGauss to perform various geometric operations, such as scaling, translation, rotation, and determining intersections.

· Points
Points are the fundamental two-dimensional building block for geometric types. Values of the point type are specified using either of the following syntaxes:

**( x , y )
x , y**

x and y are the respective coordinates, as floating-point numbers.

Points are output using the first syntax.

·Line Segments

Line segments (lseg) are represented by pairs of points. Values of the lseg type are specified using any of the following syntaxes:

**[ ( x1 , y1 ) , ( x2 , y2 ) ]
( ( x1 , y1 ) , ( x2 , y2 ) )
( x1 , y1 ) , ( x2 , y2 )
x1 , y1   ,   x2 , y2**

(x1,y1) and (x2,y2) are the end points of the line segment.

Line segments are output using the first syntax.

·Boxes

Boxes are represented by pairs of points that are opposite corners of the box. Values of the box type are specified using any of the following syntaxes:

**( ( x1 , y1 ) , ( x2 , y2 ) )
( x1 , y1 ) , ( x2 , y2 )
x1 , y1   ,   x2 , y2**

(x1,y1) and (x2,y2) are any two opposite corners of the box.

Boxes are output using the second syntax.

Any two opposite corners can be supplied on input, but in this order, the values will be reordered as needed to store the upper right and lower left corners.

·Paths
Paths are represented by lists of connected points. Paths can be open, where the first and last points in the list are considered not connected, or closed, where the first and last points are considered connected.

Values of the path type are specified using any of the following syntaxes:

**[ ( x1 , y1 ) , ... , ( xn , yn ) ]
( ( x1 , y1 ) , ... , ( xn , yn ) )
( x1 , y1 ) , ... , ( xn , yn )
( x1 , y1   , ... ,   xn , yn )
x1 , y1   , ... ,   xn , yn**

The points are the end points of the line segments comprising the path. Square brackets ([]) indicate an open path, while parentheses (()) indicate a closed path. When the outermost parentheses are omitted, as in the third through fifth syntax, a closed path is assumed.

Paths are output using the first or second syntax.

·Polygons

Polygons are represented by lists of points (the vertexes of the polygon). Polygons are very similar to closed paths, but are stored differently and have their own set of support functions.

Values of the polygon type are specified using any of the following syntaxes:

**( ( x1 , y1 ) , ... , ( xn , yn ) )
( x1 , y1 ) , ... , ( xn , yn )
( x1 , y1   , ... ,   xn , yn )
x1 , y1   , ... ,   xn , yn**

The points are the end points of the line segments comprising the boundary of the polygon.

Polygons are output using the first syntax.

·Circles

Circles are represented by a center point and radius. Values of the circle type are specified using any of the following syntaxes:

**< ( x , y ) , r >
( ( x , y ) , r )
( x , y ) , r
x , y   , r**

(x,y) is the center point and r is the radius of the circle.

Circles are output using the first syntax.