Lossless transmission of double precision floating point

From: "Michael J(dot) Baars" <mjbaars1977(dot)pgsql(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Lossless transmission of double precision floating point
Date: 2025-07-18 07:52:02
Message-ID: CALudE+5RyfwmPBgiTqF2QuLh82Q2pODH51aaxeNKtgP9jQmwbg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I receive data from a data provider on a daily basis, and noticed how
they use fixed type floating point in text mode, to transmit data. As
you might know, this type of transmission is not lossless.

Because the PostgreSQL binary format is not very portable across
different database providers, I came up with two solutions to this
problem.

1) Pass an optional custom binary format loader to the COPY command.
2) Lossless transmission in text mode through byte arrays.

1) You already seem to be working on that, but are other database providers too?
2) I attached some code, but the COPY command refuses to accept custom
implicit typecasts. Correct? Adding dedicated casting columns seems to
be the accepted work around.

This is not a problem that needs to be solved immediately, but in the
long run, a COPY command that does accept custom implicit typecasts
would be very much appreciated.

Kind regards,
Mischa.

Attachment Content-Type Size
hexcast.tar.xz application/x-xz 1.3 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Rintaro Ikeda 2025-07-18 08:07:53 Re: Suggestion to add --continue-client-on-abort option to pgbench
Previous Message Yugo Nagata 2025-07-18 07:49:28 Re: psql: tab-completion support for COPY ... TO/FROM STDIN, STDOUT, and PROGRAM