Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t4V1Z-000p71-9e for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Oct 2024 00:51:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t4V1W-004tMu-6x for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Oct 2024 00:51:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t4V1V-004tMP-9Y for pgsql-hackers@lists.postgresql.org; Sat, 26 Oct 2024 00:51:22 +0000 Received: from m16.mail.163.com ([220.197.31.3]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t4V1P-002sqm-CK for pgsql-hackers@lists.postgresql.org; Sat, 26 Oct 2024 00:51:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=NUUM5sWdEIvqaR56KG8kHIxQq7WsZlah45b0tKaFDkM=; b=mvk8l0+R0j95fxb11e/wZDVMvFXjYKNC52UdGk4pBPe9Av1I0rq3Kze4ZZ40do UpzKmZFEPs6j5ttjFqNGPNfis8IWqPVOo1zO15vQoPVBkPALw2/cOJFdf//wTcdE MEGpEEBMgtcDsBAhi/Cs+u7RPqqa8tu4LMjns2rdNfJZc= Received: from lovely-coding (unknown [101.227.46.166]) by gzga-smtp-mtada-g0-0 (Coremail) with SMTP id _____wDXP0_9PBxnMI2sBQ--.57435S3; Sat, 26 Oct 2024 08:51:10 +0800 (CST) From: Andy Fan To: Dean Rasheed Cc: Japin Li , Jim Jones , Postgres hackers Subject: Re: New function normal_rand_array function to contrib/tablefunc. In-Reply-To: (Dean Rasheed's message of "Tue, 15 Oct 2024 11:45:03 +0100") References: <87plssezpc.fsf@163.com> <87v814wmz0.fsf@163.com> <87plpv1rb0.fsf@163.com> <87le0iqrsu.fsf@163.com> <87zfox2rx7.fsf@163.com> <87ed68gcym.fsf@163.com> Date: Sat, 26 Oct 2024 08:51:09 +0800 Message-ID: <87zfmru1oi.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wDXP0_9PBxnMI2sBQ--.57435S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrur1kCw45uw4ruF15CFyDKFg_yoWDAFcE9w n2yrn5W34DCas7tFy8Wr93AFW2gw1UtwsxWayrZF1Ika4xJ34xWr4kJanIvrn5Jay2yr13 uF45uF1kKryxujkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUUr-P5UUUUU== X-Originating-IP: [101.227.46.166] X-CM-SenderInfo: x2klx3xlid0iqsrtqiywtou0bp/xtbBZxeEU2ccMcF1UQAAsI List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > 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); I remember my IDE could detect such issue before, but failed this time. I just checked more today and it is still failing. Looks the checker is not stable and I can't find out the reason so far. main.c #include int main(int argc, char *argv[]) { unsigned int i = 0; int x = 2; printf("i = %d\n", i); printf("i = %u\n", x); return 0; } 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 scan-build clang -g main.c -o main -Wall -Wformat cppcheck main.c clang: 18.1.6 gcc: 13.3.0 Only "cppcheck --enable=all main.c" catch the warnning. Any hints on this will be appreicated. -- Best Regards Andy Fan