본문 바로가기
PostgreSQL

[PostgreSQL] 자바와 데이터 타입 매핑하기 & Postgresql → SQL 변환

by dev_haha 2023. 12. 7.

PostgreSQL 데이터 타입 ↔ SQL 데이터 타입 ↔ 자바 데이터 타입

 

PostgreSQL Data Type SQL/JDBC Data Type Java Type
bool BIT boolean
bit BIT boolean
int8 BIGINT long
bigseiral BIGINT long
oid BIGINT long
bytea BINARY byte[]
char CHAR String
bpchar CHAR String
numeric NUMERIC java.math.BigDecimal
int4 INTEGER int
serial INTEGER int
int2 SMALLINT short
smallserial SMALLINT short
float4 REAL float
float8 DOUBLE double
money DOUBLE double
name VARCHAR String
text VARCHAR String
varchar VARCHAR String
date DATE java.sql.Date
time TIME java.sql.Time
timetz TIME java.sql.Time
timestamp TIMESTAMP java.sql.Timestamp
timestampz TIMESTAMP java.sql.Timestamp
cardinal_number DISTINCT Mapping of underlying type
character_data DISTINCT Mapping of underlying type
sql_identifier DISTINCT Mapping of underlying type
time_stamp DISTINCT Mapping of underlying type
yes_or_no DISTINCT Mapping of underlying type
xml SQLXML java.sql.SQLXML
refcursor REF_CURSOR Undefined
_abc ARRAY java.sql.array

 

 

 

출처: https://www.instaclustr.com/blog/postgresql-data-types-mappings-to-sql-jdbc-and-java-data-types/