pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Verite <daniel@manitou-mail.org>
To: Marko Tiikkaja <marko@joh.to>
Cc: PostgreSQL hackers <pgsql-hackers@postgresql.org>
Subject: Re: psql: add \pset true/false
Date: Thu, 29 Oct 2015 11:51:04 +0100
Message-ID: <0949c317-3ec4-4516-a3aa-33a6cfbf5267@mm> (raw)
In-Reply-To: <56308F56.8060908@joh.to>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

	Marko Tiikkaja wrote:

> Since the default t/f output for booleans is not very user friendly, 
> attached is a patch which enables you to do for example the following:

Personally I think it would be worth having, but how about
booleans inside ROW() or composite types ?

test=> \pset true 1
Boolean TRUE display is "1".
test=> \pset false 0
Boolean FALSE display is "0".

test #1: 

test=> select 't'::bool,'f'::bool;
 bool | bool 
------+------
 1    | 0

test #2:

test=> select ('t'::bool,'f'::bool);
  row  
-------
 (t,f)

test #3:

test=> create type abc as (a bool, b bool, c bool);
test=> select (true,false,true)::abc;
   row	 
---------
 (t,f,t)


I understand that the patch translates t/f only if the output type
has the OID for bool, which is not the case in #2 or #3, but I guess
users would expect #2 to output (1,0) and #3 (1,0,1).


Best regards,
-- 
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (44+ messages)  latest in thread

Message-ID: <0949c317-3ec4-4516-a3aa-33a6cfbf5267@mm>
Permalink:  ../0949c317-3ec4-4516-a3aa-33a6cfbf5267@mm/
Also on:    postgresql.org/message-id/0949c317-3ec4-4516-a3aa-33a6cfbf5267@mm

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: daniel@manitou-mail.org, marko@joh.to
  Subject: Re: psql: add \pset true/false
  In-Reply-To: <0949c317-3ec4-4516-a3aa-33a6cfbf5267@mm>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox