Data conversion in Postgres Database

Source: Internet
Author: User
Tags postgres database

Actually, ":" Calls the cast function. Which fields can be converted into one another?
You only need to study the cast function to obtain the answer to this question. The cast function information is managed in the pg_cast table of the system.
The following table lists the types that can be converted at the current stage:
Source Type conversion target type
Int8 int2
Int8 int4
Int8 float4
Int8 float8
Int8 numeric
Int2 int8
Int2 int4
Int2 float4
Int2 float8
Int2 numeric
Int4 int8
Int4 int2
Int4 float4
Int4 float8
Int4 numeric
Float4 int8
Float4 int2
Float4 int4
Float4 float8
Float4 numeric
Float8 int8
Float8 int2
Float8 int4
Float8 float4
Float8 numeric
Numeric int8
Numeric int2
Numeric int4
Numeric float4
Numeric float8
Int4 bool
Bool int4
Int8 OID
Int2 OID
Oid int8
Int8 regproc
Int2 regproc
Regproc int8
Int8 regprocedure
Int2 regprocedure
Regprocedure int8
Int8 regtings
Int2 regtings
Int8 regoperator
Int2 regoperator
Regoperator int8
Int8 regclass
Int2 regclass
Regclass int8
Int8 regtype
Int2 regtype
Regtype int8
Int8 regconfig
Int2 regconfig
Regconfig int8
Int8 regdictionary
Int2 regdictionary
Regdictionary int8
Text regclass
Varchar regclass
Bpchar text
Bpchar varchar
Char text
Char bpchar
Char varchar
Name text
Name bpchar
Name varchar
Text char
Bpchar char
Varchar char
Text name
Bpchar name
Varchar name
Char int4
Int4 char
Abstime date
Abstime time
Abstime Timestamp
Abstime timestamptz
Reltime Interval
Date Timestamp
Date timestamptz
Time Interval
Time timetz
Timestamp abstime
Timestamp date
Timestamp time
Timestamp timestamptz
Timestamptz abstime
Timestamptz date
Timestamptz time
Timestamptz Timestamp
Timestamptz timetz
Interval reltime
Interval Time
Timetz time
Lseg point
Path point
Path Polygon
Box point
Box lseg
Box Polygon
Box circle
Polygon point
Polygon path
Polygon box
Polygon circle
Circle point
Circle box
Circle Polygon
Int8 bit
Int4 bit
Bit int8
Bit int4
CIDR text
Inet text
Bool text
Text XML
CIDR varchar
Inet varchar
Bool varchar
Varchar XML
CIDR bpchar
Inet bpchar
Bool bpchar
Bpchar XML
Numeric numeric

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.