Re: add line number as prompt option to psql

From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: add line number as prompt option to psql
Date: 2014-07-11 17:01:35
Message-ID: CAD21AoB24Jdm8400yNUKWzXomNZCOD1gXXMr2R4cP_EE3YTyJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 11, 2014 at 11:01 PM, Alvaro Herrera
<alvherre(at)2ndquadrant(dot)com> wrote:
> Jeevan Chalke wrote:
>
>> On Fri, Jul 11, 2014 at 3:13 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
>> wrote:
>
>> > And the line number should be switched to 1 when line number has
>> > reached to INT_MAX?
>>
>> Yes, when it goes beyond INT_MAX, wrap around to 1.
>>
>> BTW, I wonder, can't we simply use unsigned int instead?
>
> That was my thought also: let the variable be unsigned, and have it wrap
> around normally. So once you reach UINT_MAX, the next line number is
> zero (instead of getting stuck at UINT_MAX, which would be rather
> strange). Anyway I don't think anyone is going to reach the UINT_MAX
> limit ... I mean that would be one hell of a query, wouldn't it. If
> your query is upwards of a million lines, surely you are in deep trouble
> already.
>
> Does your text editor handle files longer than 4 billion lines?
>

As you said, if line number reached UINT_MAX then I think that this
case is too strange.
I think INT_MAX is enough for line number.

The v5 patch which Jeevan is created seems to good.
But one point, I got hunk when patch is applied to HEAD. (doc file)
So I have revised it and attached.

Regards,

-------
Sawada Masahiko

Attachment Content-Type Size
psql-line-number_v5.patch application/octet-stream 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-07-11 17:19:35 Re: add line number as prompt option to psql
Previous Message Claudio Freire 2014-07-11 17:00:35 Re: Minmax indexes