Re: Setting the number of digits after the decimal point with a psql's pset variable

From: Guillaume Lelarge <guillaume(dot)lelarge(at)dalibo(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Setting the number of digits after the decimal point with a psql's pset variable
Date: 2026-10-30 20:19:24
Message-ID: 232d4e56-4d88-40fb-8d1d-dda7994ead3c@dalibo.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 30/10/2026 20:47, Nathan Bossart wrote:
> On Fri, Oct 30, 2026 at 08:41:35AM +0000, Bertrand Drouvot wrote:
>> On Thu, Oct 29, 2026 at 09:45:54PM +0100, Guillaume Lelarge wrote:
>>> Any comments welcome :)
>>
>> I did not look at the details but I was a bit skeptical at first, as I wondered
>> whether this would open the door to similar formatting options for other data
>> types. Then I did some research and found that 645cb44c5 kind of already opened
>> the door, so I'm not sure what to think about it.
>
> I'm +1 for the idea. I've actually wanted something like $subject a handful
> of times in the past, usually when trying to format a table to be readable
> on the lists. It'd be nice to not have to amend the query with calls to
> round().
>

That's exactly my need. I'm at a customer's office trying to get some
metrics. Having lots of number like 23.12346547987 is not helpful, and
makes it harder to understand the values, especially when the table ends
up being badly formatted (yeah, I know \x).

Anyway, \pset seems the right way to get that kind of feature.

--
Guillaume Lelarge
Consultant
https://dalibo.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Nathan Bossart 2026-10-30 19:49:51 Re: tests: Don't use the initdb template for older installations