Re: proposal: alternative psql commands quit and exit

Поиск
Список
Период
Сортировка
От KAWAMICHI Ryoji
Тема Re: proposal: alternative psql commands quit and exit
Дата
Msg-id 652594193.5891867.1516785422410.JavaMail.zimbra@tkl.iis.u-tokyo.ac.jp
обсуждение исходный текст
Ответ на Re: proposal: alternative psql commands quit and exit  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: proposal: alternative psql commands quit and exit
Список pgsql-hackers
Hi,

> It's not really that complicated.  Here's a patch.  This follows what
> Tom suggested in http://postgr.es/m/30157.1513058300@sss.pgh.pa.us and
> what I suggested in
> https://www.postgresql.org/message-id/CA%2BTgmoZswp00PtcgPfQ9zbbh7HUTgsLLJ9Z1x9E2s8Y7ep048g%40mail.gmail.com
> 
> I've discovered one thing about this design that is not so good, which
> is that if you open a single, double, or dollar quote, then the
> instructions that are provided under that design do not work:
> 
> rhaas=# select $$
> rhaas$# quit
> Use \q to quit or press control-C to clear the input buffer.
> rhaas$# \q
> rhaas$# well this sucks
> rhaas$#
> 
> Obviously this leaves something to be desired, but I think it's
> probably just a matter of rephrasing the hint somehow.  I didn't have
> a good idea off-hand though, so here's the patch as I have it.


I reviewed and checked your patch on master branch, and it seems to work
well. Here are the results:


test=# create table t (quit integer);
CREATE TABLE
test=# insert into t values (1);
INSERT 0 1
test=# select quit from t;
 quit 
------
    1
(1 row)

test=# select
test-# quit
Use \q to quit or press control-C to clear the input buffer.
test-# from t;
 quit 
------
    1
(1 row)

test=# select 'quit' from t;
 ?column? 
----------
 quit
(1 row)

test=# select '
test'# quit
Use \q to quit or press control-C to clear the input buffer.
test'# ' from t;
 ?column? 
----------
         +
 quit    +
 
(1 row)

test=# select $$quit$$ from t;
 ?column? 
----------
 quit
(1 row)

test=# select $$
test$# quit
Use \q to quit or press control-C to clear the input buffer.
test$# $$ from t;
 ?column? 
----------
         +
 quit    +
 
(1 row)

test=# select 
test-# \q
bash-4.2$ 
(psql ended)

test=# select '
test'# \q
test'# ' from t;
 ?column? 
----------
         +
 \q      +
 
(1 row)

test=# select $$
test$# \q
test$# $$ from t;
 ?column? 
----------
         +
 \q      +
 
(1 row)


I tried the same test using some commands such as 'exit', 'help' or '\h', 
and this patch worked well too. Then this patch passed the 'make check' 
regression tests too. So I think it can be committed. 

But if you want to modify this patch, I'll check it again.

Thanks.

Ryoji.


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

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: [HACKERS] Refactoring identifier checks to consistently use strcmp
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: [HACKERS] proposal - Default namespaces for XPath expressions(PostgreSQL 11)