Skip to main content

VSQL formats boolean column values as "t" and "f"


David_Chen
Forum|alt.badge.img+1
Is there a way to make it format it in some other way, like true --> "true", and false --> "false", or true --> 1 and false --> 0 ?

4 replies

Aakash_Bordia
Not sure about vsql options, but you could use SQL itself to do the formatting, something like (c1 is a boolean column in table bool): dbadmin=> select case when c1 is true then 1 else 0 end from bool; case ------ 1 0 (2 rows) HTH.

David_Chen
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • August 14, 2013
I was hoping to not have to do that. In the documentation, it says that for input Vertica can accept boolean data values as 't', 'y', '1', 'yes', 'true', 1 for true and 'f', 'n', '0', 'no', 0 for false respectively. It makes sense that formatting for the output should be able to do the same formats that can be used for input.

David_Chen
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • August 21, 2013
no worries. I just wrote something to get the column data types and just cast to int all the boolean columns. but it would be nice to be able to specify how booleans are formatted when they are being output.

Forum|alt.badge.img+2
  • Participating Frequently
  • August 24, 2013
Hi David,
If you'd like to see this included in a future release, please feel free to create a topic in the "Ideas" section. Thanks for your input!