From: | Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | add line number as prompt option to psql |
Date: | 2014-06-12 17:16:52 |
Message-ID: | CAD21AoBCcSEmXvB4eF3Z+Bo+2buqK9ecidtAzV=gAniK5x0puQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
Attachment | Content-Type | Size |
---|---|---|
psql-line-number_v1.patch | application/octet-stream | 1.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-06-12 17:53:19 | Re: lo_create(oid, bytea) breaks every extant release of libpq |
Previous Message | Claudio Freire | 2014-06-12 16:42:05 | Re: B-Tree support function number 3 (strxfrm() optimization) |