pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A. Van Hook <hook@kcp.com>
To: pgsql-sql@postgresql.org
Subject: paging
Date: Mon, 26 Mar 2001 12:04:28 -0600
Message-ID: <200103261804.f2QI4cw36474@mail.postgresql.org> (raw)

I have  a simple script to automate sql statements:  q " select * from
tablename"  where q is an alias to echo "$@ ;  " | psql imdb

Turning on security breaks this script since is need s password.

    the new one works a before: q "select *..." passwd where q is now
an expect script:
#!/usr/bin/expect

set query [lindex $argv 0]
set query [lindex $argv 1]

spawn psql imdb -U hook -n
          expect "Password: ";
          send   "$passwd\n ";
          expect "imdb=# ";
          send   "$query;\r";
          expect "imdb=# ";
          send   "\q;\r";

The problem is that long query returns  invoke the paging option  so you
can scroll a page a time. Paging doesn't work  properly within the
script and even if it did , I would have to disable it in order to
redirect the output to a file or a pipe.

    I can't  find any info in the docs. Can some one point me  in the
right direction....


thanks




view thread (2+ messages)  latest in thread

Message-ID: <200103261804.f2QI4cw36474@mail.postgresql.org>
Permalink:  ../200103261804.f2QI4cw36474@mail.postgresql.org/
Also on:    postgresql.org/message-id/200103261804.f2QI4cw36474@mail.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: hook@kcp.com
  Subject: Re: paging
  In-Reply-To: <200103261804.f2QI4cw36474@mail.postgresql.org>
  References: <200103261804.f2QI4cw36474@mail.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox