Thread

  1. psql -e and -n flags

    Peter Eisentraut <peter_e@gmx.net> — 2000-02-06T13:07:26Z

    As you surely noticed, the psql -e flag ("echo" modus, if you will) has
    changed its format (regression tests ring a bell?) in that it echoes the
    input file verbatim. For the particular case of the regression tests this
    seems like a good thing to me since you see the comments as well. However,
    I also offer the "old" mode that merely echoes the actual queries as they
    are sent to the backend (which, as we know since the array syntax thing,
    can be quite different), but there's no option for this.
    
    The suggestion I have is to offer the traditional behaviour with a single
    -e flag, so there's little change for anyone switching from <7.0, and the
    "full" echo mode with two -e flags. I'd then change the flags in the
    regression drivers to -e -e. Comments? Better ideas?
    
    Furthermore, does anyone have anything to say in defence of the -n ("no
    readline") option? If not, I'd be tempted to "hide" it now, since it may
    be a popular option letter to have available in the future.
    
    -- 
    Peter Eisentraut                  Sernanders väg 10:115
    peter_e@gmx.net                   75262 Uppsala
    http://yi.org/peter-e/            Sweden
    
    
    
  2. Re: [HACKERS] psql -e and -n flags

    Tom Lane <tgl@sss.pgh.pa.us> — 2000-02-06T15:54:42Z

    Peter Eisentraut <peter_e@gmx.net> writes:
    > The suggestion I have is to offer the traditional behaviour with a single
    > -e flag, so there's little change for anyone switching from <7.0, and the
    > "full" echo mode with two -e flags. I'd then change the flags in the
    > regression drivers to -e -e. Comments? Better ideas?
    
    Seems reasonable.
    
    > Furthermore, does anyone have anything to say in defence of the -n ("no
    > readline") option? If not, I'd be tempted to "hide" it now, since it may
    > be a popular option letter to have available in the future.
    
    readline automatically turns off if the input is not coming from a
    terminal, right?  That seems like the only really compelling reason
    to have -n (since you wouldn't want script commands filling your
    history or being subject to tab-completion).  I suppose someone who
    really hated tab-completion might want a way to turn off just that
    feature, though --- is there a way?
    
    BTW, if you need one more item for your psql todo list ;-) ... when
    looking at EXPLAIN outputs it's possible to get NOTICE messages that
    fill many screensful.  It might be nice if NOTICEs went through the
    pager like query results do.
    
    			regards, tom lane
    
    
  3. Re: [HACKERS] psql -e and -n flags

    Thomas Lockhart <lockhart@alumni.caltech.edu> — 2000-02-06T16:34:40Z

    > The suggestion I have is to offer the traditional behaviour with a single
    > -e flag, so there's little change for anyone switching from <7.0, and the
    > "full" echo mode with two -e flags. I'd then change the flags in the
    > regression drivers to -e -e. Comments? Better ideas?
    
    Hmm. imho having a *count* of switch options being significant is the
    wrong way to go. It gets in the way of things like
    
    # alias ps psql -e
    # ps -e postgres
    
    where someone has defined a "convenience" alias for everyone and
    someone else uses it later. Also, it is a style of switch invocation
    not appearing elsewhere afaik.
    
    I'd suggest a switch style like "-ee" or "-eb" (backend) or "-ev"
    (verbatim) or ??? Comments?
    
                       - Thomas
    
    -- 
    Thomas Lockhart				lockhart@alumni.caltech.edu
    South Pasadena, California
    
    
  4. Re: [HACKERS] psql -e and -n flags

    Karl DeBisschop <kdebisschop@range.infoplease.com> — 2000-02-06T16:49:32Z

    >I'd suggest a switch style like "-ee" or "-eb" (backend) or "-ev"
    >(verbatim) or ??? Comments?
    
    Don's suggestion seems the right track for me.
    
    It stays away from counting flags, which seems right.  It sticks with
    one-char flags for single dashes whihc is not the law but is common
    enough to be intuitive for many users.  PLus there's an aesthetic
    appeal to -e for 'echo' and -E for 'echo everything'.  It also does
    not change current behavior in cases where people are expecting psql
    -e to behave a certain way.
    
    Just my $0.02 worth as a user.
    
    
    
  5. Re: [HACKERS] psql -e and -n flags

    Roland Roberts <roberts@panix.com> — 2000-02-06T19:52:41Z

    >>>>> "tl" == Thomas Lockhart <lockhart@alumni.caltech.edu> writes:
    
        tl> I'd suggest a switch style like "-ee" or "-eb" (backend) or
        tl> "-ev" (verbatim) or ??? Comments?
    
    With the typical switch bundling, how is -ee different from -e -e?  It
    is not unusual for programs to use -v for `verbose' with multiple -v's
    possible.
    
    roland
    --
    		       PGP Key ID: 66 BC 3B CD
    Roland B. Roberts, PhD                  Custom Software Solutions
    roberts@panix.com                      76-15 113th Street, Apt 3B
    rbroberts@acm.org                          Forest Hills, NY 11375
    
    
  6. Re: [HACKERS] psql -e and -n flags

    Peter Eisentraut <peter_e@gmx.net> — 2000-02-07T19:49:42Z

    On 2000-02-06, Tom Lane mentioned:
    
    > > Furthermore, does anyone have anything to say in defence of the -n ("no
    > > readline") option? If not, I'd be tempted to "hide" it now, since it may
    > > be a popular option letter to have available in the future.
    > 
    > readline automatically turns off if the input is not coming from a
    > terminal, right?  That seems like the only really compelling reason
    > to have -n (since you wouldn't want script commands filling your
    > history or being subject to tab-completion).  I suppose someone who
    
    You're right, readline is of course not used if the session is not
    interactive. The fact of the matter is that the flag isn't even checked in
    that case and things like loading the history file (a real hog) is not
    done either.
    
    > really hated tab-completion might want a way to turn off just that
    > feature, though --- is there a way?
    
    Sure. Put
      $if psql
      set disable-completion on
      $endif
    in your ~/.inputrc. (Whoever came up with that double negative, though?)
    
    > BTW, if you need one more item for your psql todo list ;-) ... when
    > looking at EXPLAIN outputs it's possible to get NOTICE messages that
    > fill many screensful.  It might be nice if NOTICEs went through the
    > pager like query results do.
    
    Oh boy, I can't promise anything there at this point in time.
    
    -- 
    Peter Eisentraut                  Sernanders väg 10:115
    peter_e@gmx.net                   75262 Uppsala
    http://yi.org/peter-e/            Sweden
    
    
    
  7. Re: [HACKERS] psql -e and -n flags

    Peter Eisentraut <peter_e@gmx.net> — 2000-02-07T19:49:56Z

    On 2000-02-06, Thomas Lockhart mentioned:
    
    > > The suggestion I have is to offer the traditional behaviour with a single
    > > -e flag, so there's little change for anyone switching from <7.0, and the
    > > "full" echo mode with two -e flags. I'd then change the flags in the
    > > regression drivers to -e -e. Comments? Better ideas?
    > 
    > Hmm. imho having a *count* of switch options being significant is the
    > wrong way to go. It gets in the way of things like
    > 
    > # alias ps psql -e
    > # ps -e postgres
    > 
    > where someone has defined a "convenience" alias for everyone and
    > someone else uses it later. Also, it is a style of switch invocation
    > not appearing elsewhere afaik.
    
    I don't like it either, but I wasn't sure of a better way.
    
    > 
    > I'd suggest a switch style like "-ee" or "-eb" (backend) or "-ev"
    > (verbatim) or ??? Comments?
    
    Well that is an option style that doesn't appear anywhere either other
    than perhaps find(1). getopt() would read "-ee" exactly as "-e -e", a
    behaviour which conforms to POSIX and GNU and ROW (rest of world).
    
    -- 
    Peter Eisentraut                  Sernanders väg 10:115
    peter_e@gmx.net                   75262 Uppsala
    http://yi.org/peter-e/            Sweden