Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gTiiJ-00067i-LD for pgsql-general@arkaria.postgresql.org; Mon, 03 Dec 2018 07:32:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gTiiG-0006HF-4T for pgsql-general@arkaria.postgresql.org; Mon, 03 Dec 2018 07:32:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gTiiF-0006H8-NI for pgsql-general@lists.postgresql.org; Mon, 03 Dec 2018 07:32:15 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gTii7-0000rt-Qh for pgsql-general@postgresql.org; Mon, 03 Dec 2018 07:32:13 +0000 Received: from [192.168.127.1] (port=44777 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1gTii4-0006Xt-Aa; Mon, 03 Dec 2018 07:32:04 +0000 Received: from [127.0.0.1] (port=29616 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1gTii3-00096w-Fi; Mon, 03 Dec 2018 07:32:03 +0000 From: Andrew Gierth To: Glenn Schultz Cc: pgsql-general@postgresql.org Subject: Re: using a function in where In-Reply-To: (Glenn Schultz's message of "Mon, 3 Dec 2018 02:06:29 -0500") Message-ID: <87bm633w74.fsf@news-spur.riddles.org.uk> References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Mon, 03 Dec 2018 07:32:02 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Glenn" == Glenn Schultz writes: Glenn> All, Glenn> I am using the function below to convert a continuous variable Glenn> to a binned value. Sometimes a value other than zero is passed Glenn> through the query. For example -.5 result value is passed to the Glenn> query result. The basic of the query is below. Glenn> select Glenn> incentivebin(wac, rate, .25) Glenn> from Glenn> my_table Glenn> where incentivebin(was, rate, .25) = 0 Those two calls to incentivebin() have different parameters - is that an error in the original query, or a typo in transcribing it to email? -- Andrew (irc:RhodiumToad)