Supported Data Types
Types in the source DB are converted to types in the destination DB as follows: the source driver maps the types of the source DB to Go types, and then encoders are used to convert data to the binary format of the destination DB.
The following Oracle data types are supported:
NUMBER, CHAR, NCHAR, VARCHAR, NVARCHAR, VARCHAR2, NVARCHAR2, STRING, DATE, LONG, LONG RAW, CLOB, NCLOB, BLOB, BFILE, RAW(16), RAW(32), RAW, ROWID, UROWID, FLOAT, DEC, DECIMAL, DOUBLE PRECISION, INT, INTEGER, BINARY_INTEGER, PLS_INTEGER, SMALLINT, REAL, BINARY_FLOAT, BINARY_DOUBLE, TIMESTAMP, BOOLEAN, INTERVAL, XMLTYPE, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE, VARRAY.
The following PostgreSQL data types are supported:
BFILE, BOOLEAN, BYTEA, CHAR, CHARACTER VARYING(N), VARCHAR(N), CHARACTER(N), CHAR(N), BPCHAR(N), BPCHAR, DBMS_LOB.BLOB, DBMS_LOB.CLOB, NAME, TEXT, SMALLINT, INTEGER, BIGINT, DECIMAL, NUMERIC, REAL, DOUBLE PRECISION, SMALLSERIAL, SERIAL, BIGSERIAL, TIMESTAMP, DATE, TIME, INTERVAL, HSTORE, UUID, XML, JSON, JSONB, OID, MONEY, CIDR, INET, MACADDR, MACADDR8, tsquery, tsvector, txid_snapshot, pg_snapshot, pg_lsn, and custom data types.
When transferring data of the MONEY type, the value is read from the source without the currency sign, and the data is written to the destination with the currency sign corresponding to the destination locale.
The following table explains the mapping between Oracle and PostgreSQL data types:
| Oracle Type | Go Type | PostgreSQL Type |
|---|---|---|
VARCHAR2 NVARCHAR2 CHAR NCHAR LONG |
|
text char(n) varchar(n) bool |
CLOB NCLOB |
|
dbms_lob.clob text |
|
|
real double precision smallint integer bigint numeric smallserial serial bigserial |
FLOAT DEC DECIMAL NUMBER |
|
|
|
|
|
|
|
|
TIMESTAMP(0) TIMESTAMP(3) TIMESTAMP(6) TIMESTAMP(9) TIMESTAMP(0) WITH TIME ZONE TIMESTAMP(3) WITH TIME ZONE TIMESTAMP(6) WITH TIME ZONE TIMESTAMP(9) WITH TIME ZONE |
|
|
LONG RAW BLOB RAW |
|
sfile dbms_lob.blob bytea |
|
model.BFile
{
alias string,
filename string
}
|
|
|
|
|
|
model.Interval
{
Years int
Months int
Days int
Hours int
Minutes int
Seconds int
Milliseconds int
Sign int
}
|
|
Several next tables explain mapping of PostgreSQL data types to files in the Parquet format.
The table below explains mapping of numeric data types:
| PostgreSQL Type | Parquet Type | PostgreSQL Example | Parquet Example | Comment |
|---|---|---|---|---|
|
|
5 |
5 |
|
|
|
5 |
5 |
|
|
|
5 |
5 |
|
|
|
-1.258 |
0xFFFFFFFFFFFFFFFFFFFFFFFFB5047180 |
Precision 38 and scale 9 are only supported. The physical type is |
|
|
-1.258 |
0xFFFFFFFFFFFFFFFFFFFFFFFFB5047180 |
The comment for the |
|
|
129.153 |
129.1529998779297 |
|
|
|
-1.258 |
-1.258 |
The table below explains mapping of monetary data types:
| PostgreSQL Type | Parquet Type | PostgreSQL Example | Parquet Example | Comment |
|---|---|---|---|---|
|
|
$1.25 |
1.25 |
The type is mapped as a string without the currency sign. |
The table below explains mapping of string data types:
| PostgreSQL Type | Parquet Type | PostgreSQL Example | Parquet Example | Comment |
|---|---|---|---|---|
|
|
"test string" |
"test string" |
Among others, |
|
|
"test" |
"test" |
If the string is shorter than the length, remaining characters are filled with spaces. |
|
|
"test string" |
"test string" |
The table below explains mapping of date/time data types:
| PostgreSQL Type | Parquet Type | PostgreSQL Example | Parquet Example | Comment |
|---|---|---|---|---|
|
|
"2006-01-02 15:04:05" |
1136214245000000 |
|
|
|
"02 Jan 06 15:04 EST" |
1136232240000000 |
The time zone and precision are ignored. Microseconds are returned. |
|
|
"2006-01-02" |
2006-01-02 |
A date is stored as a string in this format. BC dates are not supported. |
|
|
"15:04:05" |
54245000000 |
The number of microseconds since the start of the day. |
|
|
"1 years 0 mons 2 days 3 hours 20 mins 0.0 secs" |
1 year 2 days 03:20:00 |
The physical type is Bear in mind that this mapping is performed with a loss of accuracy: while PostgreSQL stores MinMax statistics are not collected for this type. If the statistics for this type are available, the following duckDB query results in errors:
|
The table below explains mapping of other data types.
| PostgreSQL Type | Parquet Type | PostgreSQL Example | Parquet Example |
|---|---|---|---|
|
|
TRUE |
true |
|
|
"test bytes" |
"test bytes" |
|
The Parquet type |