Re: Two small patches for the isolationtester lexer - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Two small patches for the isolationtester lexer
Date
Msg-id 70FF0777-BD41-4A15-AA6E-162E25EBC8C8@yesql.se
Whole thread Raw
In response to Re: Two small patches for the isolationtester lexer  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Two small patches for the isolationtester lexer  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> On 22 Feb 2018, at 05:12, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Daniel Gustafsson <daniel@yesql.se> writes:
>> On 21 Feb 2018, at 21:41, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> I can't think of one; but I wonder if it's worth working a bit harder and
>>> removing the fixed limit altogether, probably by using a PQExpBuffer.
>>> If you've hit 1024 today, somebody will bump up against 2048 tomorrow.
>
>> The thought did cross my mind, but I opted for the simple hack first.  I can
>> take a stab at using a PQExpBuffer to see where that leads.
>
> Another idea is just to teach addlitchar to realloc the buffer bigger
> when necessary.

I think this is the best approach for the task, the attached patch changes the
static allocation to instead realloc when required.  Having an upper limit on
the allocation seemed like a good idea to me, but perhaps it’s overthinking and
complicating things for no good reason.

cheers ./daniel


Attachment

pgsql-hackers by date:

Previous
From: "Kato, Sho"
Date:
Subject: Scenario using pg_rewind
Next
From: Daniel Gustafsson
Date:
Subject: Re: Two small patches for the isolationtester lexer