Re: Built-in CTYPE provider

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Daniel Verite <daniel(at)manitou-mail(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jeremy Schneider <schneider(at)ardentperf(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Built-in CTYPE provider
Date: 2024-03-17 21:46:33
Message-ID: 3422201.1710711993@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> New series attached.

Coverity thinks there's something wrong with builtin_validate_locale,
and as far as I can tell it's right: the last ereport is unreachable,
because required_encoding is never changed from its initial -1 value.
It looks like there's a chunk of logic missing there, or else that
the code could be simplified further.

/srv/coverity/git/pgsql-git/postgresql/src/backend/utils/adt/pg_locale.c: 2519 in builtin_validate_locale()
>>> CID 1594398: Control flow issues (DEADCODE)
>>> Execution cannot reach the expression "encoding != required_encoding" inside this statement: "if (required_encoding >= 0 ...".
2519 if (required_encoding >= 0 && encoding != required_encoding)
2520 ereport(ERROR,
2521 (errcode(ERRCODE_WRONG_OBJECT_TYPE),
2522 errmsg("encoding \"%s\" does not match locale \"%s\"",
2523 pg_encoding_to_char(encoding), locale)));

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-03-17 23:02:24 Re: Autogenerate some wait events code and documentation
Previous Message Christophe Pettus 2024-03-17 21:05:54 Re: Regression tests fail with musl libc because libpq.so can't be loaded