Re: [GENERAL] psql and tab-delimited output

2014-09-09 Thread Adrian Klaver
On 09/08/2014 11:45 AM, Abelard Hoffman wrote: Hi Alban. On Sun, Sep 7, 2014 at 4:18 AM, Alban Hertroys mailto:haram...@gmail.com>> wrote: On 07 Sep 2014, at 10:45, Abelard Hoffman mailto:abelardhoff...@gmail.com>> wrote: > For reports, everyone else mostly uses other tools? I'd like t

Re: [GENERAL] psql and tab-delimited output

2014-09-08 Thread Abelard Hoffman
On Sun, Sep 7, 2014 at 5:17 PM, Melvin Davidson wrote: > >the output I'd prefer is: > > id fld_1 > > 1 test\tvalue > > 2 test\tvalue > > 3 >test\tvalue > > > > > > *Does this work for you?copy (SELECT id, replace(fld_1, '', '\t') FROM > tsv_test) to stdout with csv header delimiter '';*

Re: [GENERAL] psql and tab-delimited output

2014-09-08 Thread Abelard Hoffman
Hi Alban. On Sun, Sep 7, 2014 at 4:18 AM, Alban Hertroys wrote: > On 07 Sep 2014, at 10:45, Abelard Hoffman > wrote: > > > For reports, everyone else mostly uses other tools? I'd like to stay > away from GUI-tools, if possible. > > For reporting, usually you use the data in the database directl

Re: [GENERAL] psql and tab-delimited output

2014-09-08 Thread Abelard Hoffman
On Sun, Sep 7, 2014 at 12:28 PM, Jeff Janes wrote: > On Sat, Sep 6, 2014 at 12:32 AM, Abelard Hoffman > wrote: > [snip] > I know that COPY() will escape tabs (as \t), and we can use that from psql >> with the \copy command, but that does not include a header row of the >> column names. >> > > W

Re: [GENERAL] psql and tab-delimited output

2014-09-07 Thread Melvin Davidson
>the output I'd prefer is: > id fld_1 > 1 test\tvalue > 2 test\tvalue > 3 >test\tvalue *Does this work for you?copy (SELECT id, replace(fld_1, '', '\t') FROM tsv_test) to stdout with csv header delimiter '';query returned copy data:idreplace1test\tvalue2test\tvalue3

Re: [GENERAL] psql and tab-delimited output

2014-09-07 Thread Jeff Janes
On Sat, Sep 6, 2014 at 12:32 AM, Abelard Hoffman wrote: > Hi. > > Traditionally, to generate a TSV report, I've simply invoked psql with: > --no-align --field-separator '\t' --pset footer=off > > That works in most cases, except when your column values contain tabs > themselves. > > I know that C

Re: [GENERAL] psql and tab-delimited output

2014-09-07 Thread Adrian Klaver
On 09/07/2014 01:45 AM, Abelard Hoffman wrote: On Sat, Sep 6, 2014 at 11:43 AM, Adrian Klaver mailto:adrian.kla...@aklaver.com>> wrote: On 09/06/2014 10:34 AM, Abelard Hoffman wrote: On Sat, Sep 6, 2014 at 7:28 AM, Adrian Klaver mailto:adrian.kla...@aklaver.com> <

Re: [GENERAL] psql and tab-delimited output

2014-09-07 Thread David G Johnston
Alban Hertroys-4 wrote > On 07 Sep 2014, at 10:45, Abelard Hoffman < > abelardhoffman@ > > wrote: > >> For reports, everyone else mostly uses other tools? I'd like to stay away >> from GUI-tools, if possible. > > For reporting, usually you use the data in the database directly. > > A TSV or CS

Re: [GENERAL] psql and tab-delimited output

2014-09-07 Thread Alban Hertroys
On 07 Sep 2014, at 10:45, Abelard Hoffman wrote: > For reports, everyone else mostly uses other tools? I'd like to stay away > from GUI-tools, if possible. For reporting, usually you use the data in the database directly. A TSV or CSV file is not a report, it’s at best a data source for your r

Re: [GENERAL] psql and tab-delimited output

2014-09-07 Thread Abelard Hoffman
On Sat, Sep 6, 2014 at 11:43 AM, Adrian Klaver wrote: > On 09/06/2014 10:34 AM, Abelard Hoffman wrote: > >> On Sat, Sep 6, 2014 at 7:28 AM, Adrian Klaver > > wrote: >> >> On 09/06/2014 12:32 AM, Abelard Hoffman wrote: >> >> [snip] >> >> So, my questio

Re: [GENERAL] psql and tab-delimited output

2014-09-06 Thread Adrian Klaver
On 09/06/2014 10:34 AM, Abelard Hoffman wrote: On Sat, Sep 6, 2014 at 7:28 AM, Adrian Klaver mailto:adrian.kla...@aklaver.com>> wrote: On 09/06/2014 12:32 AM, Abelard Hoffman wrote: [snip] So, my question is, what's the simplest way to generate tab-escaped TSV-formatted rep

Re: [GENERAL] psql and tab-delimited output

2014-09-06 Thread Abelard Hoffman
On Sat, Sep 6, 2014 at 7:28 AM, Adrian Klaver wrote: > On 09/06/2014 12:32 AM, Abelard Hoffman wrote: [snip] > So, my question is, what's the simplest way to generate tab-escaped >> TSV-formatted reports with the first line containing the list of column >> names? >> >> > > create table tsv_test

Re: [GENERAL] psql and tab-delimited output

2014-09-06 Thread Adrian Klaver
On 09/06/2014 12:32 AM, Abelard Hoffman wrote: Hi. Traditionally, to generate a TSV report, I've simply invoked psql with: --no-align --field-separator '\t' --pset footer=off That works in most cases, except when your column values contain tabs themselves. I know that COPY() will escape tabs (

Re: [GENERAL] psql and tab-delimited output

2014-09-06 Thread Thomas Kellerer
Abelard Hoffman wrote on 06.09.2014 09:32: Traditionally, to generate a TSV report, I've simply invoked psql with: --no-align --field-separator '\t' --pset footer=off That works in most cases, except when your column values contain tabs themselves. I know that COPY() will escape tabs (as \t), a