misc psql questions

Поиск
Список
Период
Сортировка
От James Thompson
Тема misc psql questions
Дата
Msg-id Pine.LNX.4.21.0102151129070.4374-100000@hobbes
обсуждение исходный текст
Ответ на Re: Case insensitive selects?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: misc psql questions  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-general
About a lifetime ago I used to do quite a bit of work w/ Oracle.

It's command line sql tool had some pretty nice features that I haven't
been able to find in psql.  I was wondering if any of the following
existed....

I think the first was called break on which altered in output from
something like

name    date        qty
-------------------------
Fred    01-JAN-2000 10
Fred    10-JAN-2000 13
Fred    01-JUL-2000 1
Fred    01-DEC-2000 100
Bob     01-JAN-2000 5
Bob     10-MAY-2000 10

to

name    date        qty
-------------------------
Fred    01-JAN-2000 10
        10-JAN-2000 13
        01-JUL-2000 1
        01-DEC-2000 100
Bob     01-JAN-2000 5
        10-MAY-2000 10

it also allowed for things like compute sum which would activate on breaks
but I don't recall how they worked.

The other thing I'd love to be able to do is get user input while running
a sql file.  I don't recall how this worked exactly but the script would
either accept variables calling the script or prompt for them.

So if I had a sql script in a file named contact_report.  And I did

prod=> \i contact_report 01-JAN-2000 31-DEC-2001

then it would load the script and replace IIRC &1 and &2 with the
respective dates listed on command line.

It also had an ACCEPT command that would cause it to prompt for input from
user and assign to a varable name.  like

accept amount prompt 'Enter the amount to search for: '
select * from foo where quantity = &amount

These made it very easy to build simple reports and scripts for less
technical end users.

Is any of this possible with psql?

Thanks,
James

->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
James Thompson    138 Cardwell Hall  Manhattan, Ks   66506    785-532-0561
Kansas State University                          Department of Mathematics
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<



В списке pgsql-general по дате отправления:

Предыдущее
От: Hunter Hillegas
Дата:
Сообщение: Current Year
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: misc psql questions