st 23. 12. 2020 v 15:21 odesílatel Bruce Momjian <bruce@momjian.us> napsal:
On Wed, Dec 23, 2020 at 07:18:24AM +0100, Pavel Stehule wrote: > Hi > > I am playing with clipboard on Linux, and I found a way, how to redirect psql > output to clipboard via wl-copy or xclip and then to Libre Office. Now it looks > so best format is tsv > > select * from pg_database \g (format=tsv) | wl-paste -t application/ > x-libreoffice-tsvc > > Implementation of tsv format should not be hard. > > What do you think about this?
How would you handle tabs in the data?
This is a hard question. tabs in data in tsv are handled by backslash escaping.
Unfortunately, after some check, the LibreOffice Calc has its own format. It is not true tsv. Looks much more like CSV with a tabelator as a separator. And the current implementation is buggy. It is working well only when data doesn't hold some special chars :-/. The special chars are deleted when data is exported from LO, and when data are imported with some special chars, then the imported line can be deformated. Looks so LO should be fixed first.
This command is working well - comma, quotes, or double quotes are working