Skip to content

Instantly share code, notes, and snippets.

@wrobstory
Created August 25, 2016 20:10
Show Gist options
  • Save wrobstory/4b0ce4e8ba51ec40c494881bc126c003 to your computer and use it in GitHub Desktop.
Save wrobstory/4b0ce4e8ba51ec40c494881bc126c003 to your computer and use it in GitHub Desktop.
PostgreSQL Data Types AWS DMS Data Types Redshift Data Types
INTEGER INT4 INT4
SMALLINT INT2 INT2
BIGINT INT8 INT8
NUMERIC (p,s) If precision is 39 or greater, then use STRING. If the scale is => 0 and =< 37 then: NUMERIC (p,s) If the scale is => 38 and =< 127 then: VARCHAR (Length)
DECIMAL(P,S) If precision is 39 or greater, then use STRING. If the scale is => 0 and =< 37 then: NUMERIC (p,s) If the scale is => 38 and =< 127 then: VARCHAR (Length)
REAL REAL4 FLOAT4
DOUBLE REAL8 FLOAT8
SMALLSERIAL INT2 INT2
SERIAL INT4 INT4
BIGSERIAL INT8 INT8
MONEY Note: The MONEY data type is mapped to FLOAT in SQL Server. VARCHAR(108) (largest serialized value is “-$92,233,720,368,547,758.08”, 28 chars)
CHAR WSTRING (1) NVARCHAR(1)
CHAR(N) WSTRING (n) If the length is => 1 and =< 65535 then: NVARCHAR (Length in Bytes) If the length is => 65536 and =< 2147483647, then: NVARCHAR (65535)
VARCHAR(N) WSTRING (n) If the length is => 1 and =< 65535, then: NVARCHAR (Length in Bytes) If the length is => 65536 and =< 2147483647, then: NVARCHAR (65535)
TEXT NCLOB NVARCHAR(65535)
BYTEA BLOB VARCHAR(MAX)
TIMESTAMP TIMESTAMP If the scale is => 0 and =< 6, then: TIMESTAMP (s) If the scale is => 7 and =< 9, then: VARCHAR (37)
TIMESTAMP (z) TIMESTAMP If the scale is => 0 and =< 6, then: TIMESTAMP (s) If the scale is => 7 and =< 9, then: VARCHAR (37)
TIMESTAMP with time zone Not supported
DATE DATE DATE
TIME TIME VARCHAR(20)
TIME (z) TIME VARCHAR(20)
INTERVAL STRING (128)—1 YEAR, 2 MONTHS, 3 DAYS, 4 HOURS, 5 MINUTES, 6 SECONDS VARCHAR(128)
BOOLEAN STRING (1) F or T VARCHAR(1)
ENUM STRING (64) VARCHAR(64)
CIDR STRING (50) VARCHAR(50)
INET STRING (50) VARCHAR(50)
MACADDR STRING (18) VARCHAR(18)
BIT (n) STRING (n) VARCHAR(n)
BIT VARYING (n) STRING (n) VARCHAR(n)
UUID STRING CHAR(36)
TSVECTOR CLOB VARCHAR(MAX)
TSQUERY CLOB VARCHAR(MAX)
XML CLOB VARCHAR(MAX)
POINT STRING (255) "(x,y)" VARCHAR(255)
LINE STRING (255) "(x,y,z)" VARCHAR(255)
LSEG STRING (255) "((x1,y1),(x2,y2))" VARCHAR(255)
BOX STRING (255) "((x1,y1),(x2,y2))" VARCHAR(255)
PATH CLOB "((x1,y1),(xn,yn))" VARCHAR(MAX)
POLYGON CLOB "((x1,y1),(xn,yn))" VARCHAR(MAX)
CIRCLE STRING (255) "(x,y),r" VARCHAR(255)
JSON NCLOB VARCHAR(MAX)
ARRAY NCLOB VARCHAR(MAX)
COMPOSITE NCLOB VARCHAR(MAX)
INT4RANGE STRING (255) VARCHAR(255)
INT8RANGE STRING (255) VARCHAR(255)
NUMRANGE STRING (255) VARCHAR(255)
STRRANGE STRING (255) VARCHAR(255)
@Sarrae1406
Copy link

Boolean is now supported in Redshift.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment