I am currently obtaining a csv string from psql using copyManager in a java service.
String selectQuery = "SELECT * FROM table";
copyManager.copyOut("COPY (" + selectQuery + ") TO STDOUT WITH CSV HEADER", csaString);
But in the resulting string, all boolean values are as 't'/'f'
. How do I get the boolean values as 'true'
or 'false'
. Is there some configuration I can provide to do this?
This table has a lot of columns, so if I used a case to change it, I will also have to specify all the other columns which I want to avoid.
there's no configuration for that I'm afraid. The best you could do is casting boolean columns as text. You will have to list columns of course...
example:
db=# select *,is_dst::text from pg_timezone_names limit 1;
name | abbrev | utc_offset | is_dst | is_dst
----------------+--------+------------+--------+--------
Africa/Abidjan | GMT | 00:00:00 | f | false
(1 row)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.