Table of Data Types

I l @ ve RuBoard

The following is a table with the PostgreSQL built-in data types sorted according to what type of data they hold. This chart might be useful if you know the type of data you want to store but are unsure of the PostgreSQL designation for that data type.

Data Category

PostgreSQL Data Type (Alias Name )

Description

Geometric

BOX

Coordinates describing a rectangle.

CIRCLE

Coordinates describing a circle.

LINE

Coordinates describing an infinite line.

LSEG

Coordinates describing a line segment.

PATH

Coordinates describing a list of points.

POINT

Coordinates describing a single point.

POLYGON

Coordinates describing a polygon.

Logical Network

BOOLEAN

True or false Boolean value.

CIDR

IP / size of network segment.

INET

IP address and netmask value.

MACADDR

MAC address of an ethernet card.

Numeric [*]

BIGINT or INT8

Integer ”1 x 10^18.

DECIMAL or NUMERIC

User-defined precision and decimal rounding.

DOUBLE PRECISION or FLOAT8

Floating-point value ”15 digit.

FLOAT

Same as FLOAT8 or DOUBLE PRECISION.

INTEGER or INT4

Integer ” ± 2,147,483,648 range.

REAL or FLOAT4

Floating-point value ”six-digit precision.

SERIAL

Integer ”0 to +2147483647.

SMALLINT or INT2

Integer ” ± 32,768 range.

String

CHAR or CHARACTER

Fixed-length string ”blank padded .

TEXT

Variable-length string.

VARCHAR or CHARACTER VARYING

Variable-length string with specified limit.

Time

DATE

Day from 4713 BC to 32767 AD.

INTERVAL

Time interval ± 178,000,000 years .

TIME

Time of day 00:00:00 to 23:59:59.

TIME WITH TIME ZONE

Time of day and time zone from 00:00:00+12 to 23:59:59-12.

TIMESTAMP

Date/time from 4713 BC to 1465001 AD.

Other

BIT

Specified fixed-length binary data type.

Right-padded.

BIT VARYING

Variable-length (with maximum) binary data type.

MONEY

Fixed-precision number ± 21474836.48 (no longer used ”use FLOAT or NUMERIC (x,2) ).

NAME

Internal data type for system names .

OID

PostgreSQL object identifier.

[*] Some of the data-type names for the Numeric category are only supported in PostgreSQL 7.1. For instance, in Version 6.5, BIGINT is not supported, but INT8 is supported.

The following pages comprise a listing of the built-in data types. They are broken up according to the types of data they define. Each element is described with relevant information such as storage size, range of values, compatibility, and descriptive notes.

I l @ ve RuBoard


PostgreSQL Essential Reference
PostgreSQL Essential Reference
ISBN: 0735711216
EAN: 2147483647
Year: 2001
Pages: 118
Authors: Barry Stinson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net