add line number as prompt option to psql

Поиск
Список
Период
Сортировка
От Sawada Masahiko
Тема add line number as prompt option to psql
Дата
Msg-id CAD21AoBCcSEmXvB4eF3Z+Bo+2buqK9ecidtAzV=gAniK5x0puQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: add line number as prompt option to psql
Список pgsql-hackers
Hi all,

The attached IWP patch is one prompt option for psql, which shows
current line number.
If the user made syntax error with too long SQL then psql outputs
message as following.

ERROR:  syntax error at or near "a"
LINE 250: hoge
                ^
psql teaches me where syntax error is occurred, but it is not kind
when SQL is too long.
We can use write SQL with ¥e(editor) command(e.g., emacs) , and we can
know line number.
but it would make terminal log dirty . It will make analyzing of log
difficult after error is occurred.
(I think that we usually use copy & paste)

After attached this patch, we will be able to use %l option as prompting option.

e.g.,
$ cat ~/.psqlrc
\set PROMPT2 '%/[%l]%R%# '
\set PROMPT1 '%/[%l]%R%# '
$ psql -d postgres
postgres[1]=# select
postgres[2]-# *
postgres[3]-# from
postgres[4]-# hoge;

The past discussion is following.
<http://www.postgresql.org/message-id/CAFj8pRC1ruPk6+chA1jpxPh3uS_zipaBDOvmcEex4wPbp2kZMQ@mail.gmail.com>

Please give me feedback.

Regards,

-------
Sawada Masahiko

Вложения

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

Предыдущее
От: Claudio Freire
Дата:
Сообщение: Re: B-Tree support function number 3 (strxfrm() optimization)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: lo_create(oid, bytea) breaks every extant release of libpq