Thread: RE: [QUESTIONS] Using psql \f to change delimiter to space

RE: [QUESTIONS] Using psql \f to change delimiter to space

From
"Jackson, DeJuan"
Date:
> > When I invoke psql, the default delimiter is the pipe "|"
> > character.  I can't find the correct syntax to
> > change the delimiter back to a single space.  If I
> > type :
> > \f <whitespace> -- delimiter stays at |
> > \f \<whitespace> -- delimiter stays at |
> >
> > Enclosing the space within single or double quotes produces
> > a delimiter that actually includes the quotes.  I tried
> > octal specification \040 for the space which also failed.
> >
> > Version 6.3.2 on Linux i386 (Redhat 4).
> >
> > What's the correct syntax?
>
> I just did
>
> \f \
>     ^ space here
>
> See:
>
> ----------------------------------------------------------------------
> -----
>
> test=> \f \
> field separator changed to ''
> test=> select * from pg_user
> test-> \g
> usename usesysidusecreatedbusetraceusesuperusecatupdpasswd  valuntil
>
> ----------------------------------------------------------------------
> ------------------
> postgres     139t          t       t       t        ********Sat Jan 31
> 01:00:00 2037 EST
> (1 row)
>
Sorry to correct you Bruce but that causes the delimiter to be set to
nothing ('') not space (' ').

        -DEJ

Re: [QUESTIONS] Using psql \f to change delimiter to space

From
Bruce Momjian
Date:
>
> > > When I invoke psql, the default delimiter is the pipe "|"
> > > character.  I can't find the correct syntax to
> > > change the delimiter back to a single space.  If I
> > > type :
> > > \f <whitespace> -- delimiter stays at |
> > > \f \<whitespace> -- delimiter stays at |
> > >
> >
> Sorry to correct you Bruce but that causes the delimiter to be set to
> nothing ('') not space (' ').

I stand corrected.  This has been asked before, and the only solution I
know is:

    psql -F ' ' testdb

Is that acceptable, or do you want it to work with \f?  The problem is
that the trailing spaces are removed from all command lines, so it is not
seeing the space.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)