Re: New function normal_rand_array function to contrib/tablefunc.

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Andy Fan <zhihuifan1213(at)163(dot)com>
Cc: Japin Li <japinli(at)hotmail(dot)com>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: New function normal_rand_array function to contrib/tablefunc.
Date: 2024-10-26 10:39:34
Message-ID: CAEZATCUP6RF=oXdSxbkOp0iqLh=_SDG4TOhXYpXwHzULKNS8ig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 26 Oct 2024 at 01:51, Andy Fan <zhihuifan1213(at)163(dot)com> wrote:
>
> > 10). In this error:
> >
> > + elog(ERROR, "unsupported type %d for rand_array function.",
> > + datatype);
> >
> > "datatype" is of type Oid, which is unsigned, and so it should use
> > "%u" not "%d". Also, as above, it should not end with a period, so it
> > should be:
> >
> > + elog(ERROR, "unsupported type %u for rand_array function",
> > + datatype);
>
> All the following commands succeed without any warnings.
>
> clang -O0 -g main.c -o main -Wall -Wformat
> gcc -g main.c -o main -Wall -Wformat
>

This can be detected in gcc with -Wformat plus -Wformat-signedness flags.

I see that this has been discussed before (e.g., [1]), but it doesn't
look like those patches were committed, and there are still many such
warnings, if you try compiling postgres with those flags.

[1] https://www.postgresql.org/message-id/flat/CA%2BhUKGJ7EQm9extQAgrFZNNUKqRT8Vv5t1tKqA-5nEcYn0%2BwNA%40mail.gmail.com

I don't know if anyone has any plans to pick up that work again, but
in any case, it seems wise to not add more.

Regards,
Dean

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2024-10-26 12:00:03 Re: Can rs_cindex be < 0 for bitmap heap scans?
Previous Message Andrey M. Borodin 2024-10-26 08:40:15 Re: [PATCH] Add sortsupport for range types and btree_gist