Search Postgresql Archives

Re: The same prepared query yield "-1" the first six times and then "-1.0"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Mon, 21 Aug 2023 at 17:17, Ron <ronljohnsonjr@xxxxxxxxx> wrote:
On 8/21/23 14:32, Dave Cramer wrote:
[snip]
It has to do with the way the data is being transferred. When the driver switches to a named statement it also switches to binary mode which means data will be transferred in binary. 

In text we get -1, in binary we get -1.0

That seems odd.  Why does it do that?

If we look at float8out_internal (text output)  https://github.com/postgres/postgres/blob/6fde2d9a005a5bc04aa059d3faeb865c8dd322ce/src/backend/utils/adt/float.c#L536 and the comment about extra float digits which states 

If >0, use shortest-decimal format for output; this is both the default and
allows for compatibility with clients that explicitly set a value here to
get round-trip-accurate results. If 0 or less, then use the old, slow,
decimal rounding method.

-1 would be the shortest-decimal format. 

whereas float8send sends the actual binary data on disk, hence -1.0

Dave
--
Born in Arizona, moved to Babylonia.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux