Re: replace strtok()

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: David Steele <david(at)pgmasters(dot)net>, Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: replace strtok()
Date: 2024-10-17 10:30:00
Message-ID: bd9e6e64-f067-8651-912b-4d659db2070d@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Ranier,

16.10.2024 14:14, Ranier Vilela wrote:
> Em qua., 16 de out. de 2024 às 04:45, Peter Eisentraut <peter(at)eisentraut(dot)org> escreveu:
>
>
> This wouldn't fix anything, I think.  If colors is NULL, then strsep()
> already returns NULL, so the added code does nothing.
>
> If *colors* is NULL, then the delimiter is not found and strsep will return the entire
> string /*stringp, so the token becomes invalid/.
>
> IMO, I think it must be necessary to check if *colors* are NULL too.
>

I've tested your proposed change and what I'm seeing is that:
PG_COLOR=always PG_COLORS="error=01;31" initdb
doesn't color the "error" word:

while with only Peter's patch it works as expected:

Does your change work differently for you?

Best regards,
Alexander

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikita Malakhov 2024-10-17 11:10:04 Re: Considering fractional paths in Append node
Previous Message vignesh C 2024-10-17 10:29:01 Re: Pgoutput not capturing the generated columns