Re: New function normal_rand_array function to contrib/tablefunc.

From: Andy Fan <zhihuifan1213(at)163(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(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-27 01:30:36
Message-ID: 874j4yl4cj.fsf@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:

> 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.

Yes, this one works. I didn't realize we have "-Wformat-signedness"
subsection after we already have "-Wformat". I have added this one into
my toolset.

For recording purpose, clang doesn't support this option until now.

>
> 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.

OK, Thanks for the information. Currently I add the "c/c++-gcc" checker
for my c file, it just trigger when I am writting a file. so the
warnings in other places probably doesn't bother me.
>
> [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.
I can take that very soon.

> but in any case, it seems wise to not add more.
Very true.

Thank you for all your helps on this series.

--
Best Regards
Andy Fan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2024-10-27 03:59:51 Re: -Wformat-signedness
Previous Message Alvaro Herrera 2024-10-26 21:47:08 Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails