4.2. 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:

Table 4.2. Mapping of Oracle Types to PostgreSQL Types

Oracle TypeGo TypePostgreSQL Type
VARCHAR2
NVARCHAR2
CHAR
NCHAR
LONG
string
text
char(n)
varchar(n)
bool
CLOB
NCLOB
string
dbms_lob.clob
text
BINARY_DOUBLEfloat64
real
double precision
smallint
integer
bigint
numeric
smallserial
serial
bigserial
FLOAT
DEC
DECIMAL
NUMBER
Decimalnumeric
BINARY_FLOATfloat32real
DATEtime.Timetimestamp
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
time.Timetimestamp [with timezone]
LONG RAW
BLOB
RAW
[]byte
sfile
dbms_lob.blob
bytea
BFILE
model.BFile
{
      alias        string,
      filename string
}
bfile
BOOLEANboolbool
NTERVAL ...
model.Interval
{
    Years        int
    Months       int
    Days         int
    Hours        int
    Minutes      int
    Seconds      int
    Milliseconds int
    Sign         int
}
interval

Several next tables explain mapping of PostgreSQL data types to files in the Parquet format.

The table below explains mapping of numeric data types:

Table 4.3. Mapping of PostgreSQL Numeric Types to Files in the Parquet Format

PostgreSQL TypeParquet TypePostgreSQL ExampleParquet ExampleComment
smallintINT3255 
integerINT3255 
bigintINT6455 
numericFIXED_LEN_BYTE_ARRAY-1.2580xFFFFFFFFFFFFFFFF​FFFFFFFFB5047180

Precision 38 and scale 9 are only supported.

The physical type is FIXED_LEN_BYTE_ARRAY(16), and the logical type is DECIMAL. The minimum value is -1701411834604692​31731687303715.​884105728, and the maximum value is 1701411834604692​31731687303715.​884105727.

decimalFIXED_LEN_BYTE_ARRAY-1.2580xFFFFFFFFFFFFFFFFF​FFFFFFFB5047180The comment for the numeric type holds.
realFLOAT129.153129.1529998779297 
double precisionDOUBLE-1.258-1.258 

The table below explains mapping of monetary data types:

Table 4.4. Mapping of PostgreSQL Monetary Types to Files in the Parquet Format

PostgreSQL TypeParquet TypePostgreSQL ExampleParquet ExampleComment
moneyBYTE_ARRAY$1.251.25The type is mapped as a string without the currency sign.

The table below explains mapping of string data types:

Table 4.5. Mapping of PostgreSQL String Types to Files in the Parquet Format

PostgreSQL TypeParquet TypePostgreSQL ExampleParquet ExampleComment
varcharBYTE_ARRAY"test string""test string"Among others, varchar(n) with the specified length is supported, but the length is not taken into account.
char(10)BYTE_ARRAY"test""test"If the string is shorter than the length, remaining characters are filled with spaces.
textBYTE_ARRAY"test string""test string" 

The table below explains mapping of date/time data types:

Table 4.6. Mapping of PostgreSQL Date/Time Types to Files in the Parquet Format

PostgreSQL TypeParquet TypePostgreSQL ExampleParquet ExampleComment
timestamp without time zoneINT64"2006-01-02 15:04:05"113621424​5000000timestamp(6) is supported, but the precision is ignored. The number of microseconds since the start of the UNIX epoch is returned.
timestamp with time zoneINT64"02 Jan 06 15:04 EST"11362322​40000000The time zone and precision are ignored. Microseconds are returned.
dateBYTE_ARRAY"2006-01-02"2006-01-02A date is stored as a string in this format. BC dates are not supported.
time without time zoneINT64"15:04:05"54245000000The number of microseconds since the start of the day. timestamp(6) is supported, but the precision is ignored.
intervalFIXED_LEN_BYTE_ARRAY"1 years 0 mons 2 days 3 hours 20 mins 0.0 secs"1 year 2 days 03:20:00

The physical type is FIXED_LEN_BYTE_ARRAY(12). 4 bytes are allocated for each value of months, days, and milliseconds. The type is implemented as specified in LogicalTypes.md. The logical type is INTERVAL, and the converted type is INTERVAL.

Bear in mind that this mapping is performed with a loss of accuracy: while PostgreSQL stores interval up to microseconds, Parquet stores INTERVAL only up to milliseconds.

MinMax statistics is not collected for this type. If the statistics for this type is available, the following duckDB query results in errors:

SELECT * FROM parquet_metadata(./file.parquet)


The table below explains mapping of other data types.

Table 4.7. Mapping of PostgreSQL Other Types to Files in the Parquet Format

PostgreSQL TypeParquet TypePostgreSQL ExampleParquet Example
booleanBOOLEANTRUEtrue
byteaBYTE_ARRAY"test bytes""test bytes"

Note

The Parquet type xml is not supported at present.