Re: add line number as prompt option to psql - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: add line number as prompt option to psql
Date
Msg-id 20140711140135.GA6390@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: add line number as prompt option to psql  (Jeevan Chalke <jeevan.chalke@enterprisedb.com>)
Responses Re: add line number as prompt option to psql  (Sawada Masahiko <sawada.mshk@gmail.com>)
List pgsql-hackers
Jeevan Chalke wrote:

> On Fri, Jul 11, 2014 at 3:13 PM, Sawada Masahiko <sawada.mshk@gmail.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?

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Pg_upgrade and toast tables bug discovered
Next
From: David G Johnston
Date:
Subject: Re: Is there a way to temporarily disable a index