Re: psql shows line number

From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Marko Tiikkaja <marko(at)joh(dot)to>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql shows line number
Date: 2013-11-26 13:42:04
Message-ID: CAD21AoCYFiepJh0iUUddW8PF6OMUm4be54vup7dLJecDMkqyEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/11/26 22:24 "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>:
>
>
>
>
> 2013/11/26 Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
>>
>> On Tue, Nov 26, 2013 at 9:23 PM, Marko Tiikkaja <marko(at)joh(dot)to> wrote:
>> > On 11/26/13 1:05 PM, Sawada Masahiko wrote:
>> >>
>> >> When I execute query which contains error, the server returns error
>> >> with line number.
>> >>
>> >> ERROR: relation "hoge" does not exist
>> >> LINE 35: hoge;
>> >>
>> >> But when query is long, I was not sure the location where I wrote
wrong
>> >> SQL.
>> >> Does the psql have option which shows line number?
>> >> If no, I'm thinking to implement this feature. Thought?
>> >> I think it is useful if the psql shows line number like follows
>> >
>> >
>> > If the query is long, you'll likely want to \e to edit it anyway,
no? I'm
>> > sure any text editor worth $EDITOR will know how to jump to a specific
line.
>> Thanks!
>> ¥e is also good. I didn't know this.
>> I thought that showing line number on psql is light and simple.
>> So I thought that psql can also have such feature as standard function.
>>
>>
>> > idea is interesting, but a proposed format is not clean (and little
bit ugly, and
>> > can be barrier for copy from terminal to editor. Now, simple replace
can be used for cleaning.
>> Thanks!
>> Yes, it is little ugly.
>> I was also thinking to fill space of line number with whitespace. likes:
>>
>> [ 1]postgres=# SELECT
>> [ 2]postgres=# hoge.col1
>> :
>> [ 9]postgres=# FROM
>> [ 10]postgres=# hoge;
>>
>> But I think that it is also something just isn't right.
>>
>> > maybe we can introduce a command, that will print SQL from history
with line numbers - like \sf+
>> I think that ¥sf+ shows definition of function. How should I use this?
>
>
> yes, but we can define new statement like \sq+ (Show Query)
>
I understood.
it looks good to me.

it is similer to searching history(i.g., just push up-arrow-key)?

Regards,

Masahiko Sawada

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2013-11-26 13:43:14 Re: psql shows line number
Previous Message Pavel Stehule 2013-11-26 13:39:36 Re: new unicode table border styles for psql