Re: Formating psql query output

2021-07-19 Thread Ron
On 7/19/21 3:05 PM, Rich Shepard wrote: On Mon, 19 Jul 2021, Adrian Klaver wrote: You need them in the JOIN and/or WHERE sections, but not necessarily in the field list in the SELECT portion. Adrian, I wondered about that and thought I needed to include them in the SELECT phrase. If that w

Re: Formating psql query output

2021-07-19 Thread Rich Shepard
On Mon, 19 Jul 2021, Adrian Klaver wrote: You need them in the JOIN and/or WHERE sections, but not necessarily in the field list in the SELECT portion. Adrian, I wondered about that and thought I needed to include them in the SELECT phrase. Thanks for the lesson. Regards, Rich

Re: Formating psql query output

2021-07-19 Thread Rich Shepard
On Mon, 19 Jul 2021, Rob Sargent wrote: Postgres version? postgresql-12.7-x86_64-1_SBo

Re: Formating psql query output

2021-07-19 Thread Pavel Stehule
po 19. 7. 2021 v 21:12 odesílatel Pavel Stehule napsal: > > > po 19. 7. 2021 v 21:07 odesílatel Rich Shepard > napsal: > >> On Mon, 19 Jul 2021, Rob Sargent wrote: >> >> > Can we see on line of the csv output? The field with commas should be in >> > quotes, no? You’ll have write a “real” csv imp

Re: Formating psql query output

2021-07-19 Thread Pavel Stehule
po 19. 7. 2021 v 21:07 odesílatel Rich Shepard napsal: > On Mon, 19 Jul 2021, Rob Sargent wrote: > > > Can we see on line of the csv output? The field with commas should be in > > quotes, no? You’ll have write a “real” csv importer. awk =F”\”*,*\”” > > might, heavy on the might. > > Rob, > > Here

Re: Formating psql query output

2021-07-19 Thread Adrian Klaver
On 7/19/21 11:58 AM, Rich Shepard wrote: On Mon, 19 Jul 2021, Adrian Klaver wrote: Is there a reason you can't just restrict the query to the columns you want? Adrian, As far as I know I need to specify FK and PK columns when tables are joined; You need them in the JOIN and/or WHERE secti

Re: Formating psql query output

2021-07-19 Thread Rob Sargent
> On Jul 19, 2021, at 1:07 PM, Rich Shepard wrote: > > On Mon, 19 Jul 2021, Rob Sargent wrote: > >> Can we see on line of the csv output? The field with commas should be in >> quotes, no? You’ll have write a “real” csv importer. awk =F”\”*,*\”” >> might, heavy on the might. > > Rob, > > He

Re: Formating psql query output

2021-07-19 Thread Rich Shepard
On Mon, 19 Jul 2021, Rob Sargent wrote: Can we see on line of the csv output? The field with commas should be in quotes, no? You’ll have write a “real” csv importer. awk =F”\”*,*\”” might, heavy on the might. Rob, Here's a redacted output line: 8,2019-04-08,Phone,Went to voice mail @ 14:48;

Re: Formating psql query output

2021-07-19 Thread Rob Sargent
> On Jul 19, 2021, at 12:53 PM, Rich Shepard wrote: > > On Mon, 19 Jul 2021, Basques, Bob (CI-StPaul) wrote: > >> -F separator >> --field-separator=separator >> Use separator as the field separator for unaligned output. This is >> equivalent to \pset fieldsep or \f. > > Bobb, > > I should

Re: Formating psql query output

2021-07-19 Thread Rich Shepard
On Mon, 19 Jul 2021, Adrian Klaver wrote: Is there a reason you can't just restrict the query to the columns you want? Adrian, As far as I know I need to specify FK and PK columns when tables are joined; I don't need those key columns in the output. Thanks, Rich

Re: Formating psql query output [RESOLVED]

2021-07-19 Thread Rich Shepard
On Mon, 19 Jul 2021, David Santamauro wrote: echo 'select 1,2,3,4;' | psql -At -F'|' 1|2|3|4 -A Switches to unaligned output mode. (The default output mode is aligned.) This is equivalent to \pset format unaligned. -t Turn off printing of column names and result row count footers, etc. This is

RE: Formating psql query output

2021-07-19 Thread Rich Shepard
On Mon, 19 Jul 2021, Basques, Bob (CI-StPaul) wrote: -F separator --field-separator=separator Use separator as the field separator for unaligned output. This is equivalent to \pset fieldsep or \f. Bobb, I should have mentioned that I tried that. Without the --csv option the results have the

Re: Formating psql query output

2021-07-19 Thread Rob Sargent
> On Jul 19, 2021, at 11:49 AM, Adrian Klaver wrote: > > On 7/19/21 10:33 AM, Rich Shepard wrote: >> Until I finish building the python/tkinter/psycopg2 front end to my business >> tracking tool I continue to work using the psql shell.' >> I have a working .sql script that reports my contacts

Re: Formating psql query output

2021-07-19 Thread Adrian Klaver
On 7/19/21 10:33 AM, Rich Shepard wrote: Until I finish building the python/tkinter/psycopg2 front end to my business tracking tool I continue to work using the psql shell.' I have a working .sql script that reports my contacts between two dates; the script returns more columns than I want in

Re: Formating psql query output

2021-07-19 Thread David Santamauro
From: Rich Shepard Date: Monday, July 19, 2021 at 1:33 PM > Is there an option that will retain the '|' separator but exclude the > headings? > Reading the psql document page I don't see such an option. echo 'select 1,2,3,4;' | psql -At -F'|' 1|2|3|4 -A Switches to unaligned output mode. (

RE: Formating psql query output

2021-07-19 Thread Basques, Bob (CI-StPaul)
>From here: https://www.postgresql.org/docs/9.2/app-psql.html -F separator --field-separator=separator Use separator as the field separator for unaligned output. This is equivalent to \pset fieldsep or \f. Bobb > -Original Message- > From: Rich Shepard > Sent: Monday, July 19, 20