Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p3Pex-0003Iy-Gj for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Dec 2022 22:46:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p3Pew-0004PE-5b for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Dec 2022 22:46:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p3Pev-0004Of-Na for pgsql-hackers@lists.postgresql.org; Thu, 08 Dec 2022 22:46:29 +0000 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p3Pes-0001yk-2N for pgsql-hackers@postgresql.org; Thu, 08 Dec 2022 22:46:28 +0000 Received: by mail-il1-x134.google.com with SMTP id y2so1861195ily.5 for ; Thu, 08 Dec 2022 14:46:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=ehMKmkQgC5XGNATIteOAovqMZaJaLiBQXaceKcjJMGs=; b=3ITmRvjhEdFO8Tbi+UpbEdhi/j1SHcHMphKA9tG88mTl7f7X4WoLPBKuhTmLsVsq+c PB0eAZIlpsQPb1hmPsVws/naspNrMXnn29VNzA6mGl/BoV/9968qha/D2JvhRBafEiXP fqzJ7AqB1nL1r7Bfl53mTHY0igj5VxxNKRzDVCuGWl6V5yagczlacgw091U9PJVbtJTt eLc/u6LT/+wsZIP3dmeePdGkGRlyBEFPmEsnAEN6fyFHwQUkzhLesh+mk2mFWiJp6VPM RkWxlQQDqu7X/IHhTN1Oai9bB8b9SVGGj3zT/OqTrcr0/Y5OTcUUAHE2NJEdLEjPTEzU 2ySw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ehMKmkQgC5XGNATIteOAovqMZaJaLiBQXaceKcjJMGs=; b=n3rtbFcToAPz4RlhHWkLnyqOLhOCJ7FS7L8AX3cPZXwufnV+BoWXG8VykhuBFFoyF+ C6QSydkQuVgwDHaqN0JHc+RJi1JXuHB83iv6lBe1nqCUOhIwnI27JHPGKUdwOMD9hV7Z thwsuzj5k6ZnGmPKP3csCyerHgGYADSHXQaTMGvgvh6kdOD2SOsKHbPyQAujnh8YtVzn uNoUAEAqwcivRxiqxf6+FbS2drqZOPfvFHtVspiHWt/WKFDa7JJOuedxpEMqN5pufXWu +WZsN2K9KfyBZ2s7suIMYdeyNAlbU7VkIDiz+GZF2+kYZFTKLE1EJVnJ9+O1171cpMOU Bq/A== X-Gm-Message-State: ANoB5pnqqVzSaQGmNs0EudKrTnPib44E6JuapXfSktTIhp+yi2wQK2fT 5VSyPsRvdCfsTbOqsJI2GRi4lIhcCTXkTzxX X-Google-Smtp-Source: AA0mqf4zSk+8duAG5FwY2/BMBNyRNBHgQTp3oaVnCELl9VAkl1j7CgTSv86LKp8TWOtIfy7j2TVvHg== X-Received: by 2002:a05:6e02:1a0f:b0:303:2094:fae3 with SMTP id s15-20020a056e021a0f00b003032094fae3mr3642720ild.29.1670539585152; Thu, 08 Dec 2022 14:46:25 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id z8-20020a92d6c8000000b002fadf9505b4sm1152408ilp.16.2022.12.08.14.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 14:46:24 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id D01428010D1; Thu, 8 Dec 2022 16:46:23 -0600 (CST) Date: Thu, 8 Dec 2022 16:46:23 -0600 From: Justin Pryzby To: Paul Ramsey Cc: pgsql-hackers@postgresql.org Subject: Re: [PATCH] random_normal function Message-ID: <20221208224623.GQ27893@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Dec 08, 2022 at 01:53:23PM -0800, Paul Ramsey wrote: > Just a utility function to generate random numbers from a normal > distribution. I find myself doing this several times a year, and I am > sure I must not be the only one. > > random_normal(stddev float8 DEFAULT 1.0, mean float8 DEFAULT 0.0) +++ b/src/backend/catalog/system_functions.sql @@ -620,6 +620,13 @@ CREATE OR REPLACE FUNCTION STABLE PARALLEL SAFE AS 'sql_localtimestamp'; +CREATE OR REPLACE FUNCTION + random_normal(stddev float8 DEFAULT 1.0, mean float8 DEFAULT 0.0) +RETURNS float8 +LANGUAGE INTERNAL +STRICT VOLATILE PARALLEL SAFE +AS 'make_interval'; I guess make_interval is a typo ? This is causing it to fail tests: http://cfbot.cputube.org/paul-ramsey.html BTW you can run the same tests as CFBOT does from your own github account; see: https://www.postgresql.org/message-id/20221116232507.GO26337@telsasoft.com -- Justin