Skip to content

Commit

Permalink
Add docs for Prestodb to postgresql type mapping in postgresql connector
Browse files Browse the repository at this point in the history
  • Loading branch information
Akanksha-kedia authored and tdcmeehan committed Dec 5, 2023
1 parent 9e752cb commit 67dd546
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions presto-docs/src/main/sphinx/connector/postgresql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,106 @@ Finally, you can access the ``clicks`` table in the ``web`` schema::
If you used a different name for your catalog properties file, use
that catalog name instead of ``postgresql`` in the above examples.

Type mapping
------------

PrestoDB and PostgreSQL each support types that the other does not. When reading from or writing to PostgreSQL, Presto converts
the data types from PostgreSQL to equivalent Presto data types, and from Presto to equivalent PostgreSQL data types.

PostgreSQL to PrestoDB type mapping
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The connector maps PostgreSQL types to the corresponding PrestoDB types:

.. list-table:: PostgreSQL to PrestoDB type mapping
:widths: 70, 70
:header-rows: 1

* - PostgreSQL type
- PrestoDB type
* - ``BIT``
- ``BOOLEAN``
* - ``BOOLEAN``
- ``BOOLEAN``
* - ``SMALLINT``
- ``SMALLINT``
* - ``INTEGER``
- ``INTEGER``
* - ``BIGINT``
- ``BIGINT``
* - ``DOUBLE PRECISION``
- ``DOUBLE``
* - ``REAL``
- ``REAL``
* - ``NUMERIC(p, s)``
- ``DECIMAL(p, s)``
* - ``CHAR(n)``
- ``CHAR(n)``
* - ``VARCHAR(n)``
- ``VARCHAR(n)``
* - ``ENUM``
- ``VARCHAR``
* - ``BYTEA``
- ``VARBINARY``
* - ``DATE``
- ``DATE``
* - ``TIME``
- ``TIME``
* - ``TIMESTAMP``
- ``TIMESTAMP``
* - ``TIMESTAMPTZ``
- ``TIMESTAMP``
* - ``MONEY``
- ``DOUBLE``
* - ``UUID``
- ``UUID``
* - ``JSON``
- ``JSON``
* - ``JSONB``
- ``JSON``

No other types are supported.

PrestoDB to PostgreSQL type mapping
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The connector maps PrestoDB types to the corresponding PostgreSQL types:

.. list-table:: PrestoDB to PostgreSQL type mapping
:widths: 50, 50
:header-rows: 1

* - PrestoDB type
- PostgreSQL type
* - ``BOOLEAN``
- ``BOOLEAN``
* - ``SMALLINT``
- ``SMALLINT``
* - ``INTEGER``
- ``INTEGER``
* - ``BIGINT``
- ``BIGINT``
* - ``DOUBLE``
- ``DOUBLE PRECISION``
* - ``DECIMAL(p, s)``
- ``NUMERIC(p, s)``
* - ``CHAR(n)``
- ``CHAR(n)``
* - ``VARCHAR(n)``
- ``VARCHAR(n)``
* - ``VARBINARY``
- ``BYTEA``
* - ``DATE``
- ``DATE``
* - ``TIME``
- ``TIME``
* - ``TIMESTAMP``
- ``TIMESTAMP``
* - ``UUID``
- ``UUID``

No other types are supported.

PostgreSQL Connector Limitations
--------------------------------

Expand Down

0 comments on commit 67dd546

Please sign in to comment.