Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 25FE29FB56B for ; Wed, 11 Apr 2007 05:21:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 55289-01 for ; Wed, 11 Apr 2007 05:21:36 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id 3852F9FAC9B for ; Wed, 11 Apr 2007 05:21:38 -0300 (ADT) Received: (qmail 9698 invoked by uid 1112); 11 Apr 2007 08:21:38 -0000 Date: Wed, 11 Apr 2007 04:21:38 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Xavier Poinsard cc: pgsql-jdbc@postgresql.org Subject: random escape function Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/16 X-Sequence-Number: 16865 The escape function {fn rand(param)} isn't working on 8.3 servers because setseed has been changed to return void and reading the JDBC spec, I'm not sure it ever worked as required. We map "SELECT {fn rand(0.5)}" to "SELECT setseed(0.5)*0+random()" which worked in previous servers because the setseed call returned an int. Now we get "ERROR: operator does not exist: void * integer". So that's our immediate problem, but looking a little closer at the spec shows that rand is supposed to take an integer argument, not a float limited to 0->1. So at minimum we'd need to remap the parameter range. Also the spec doesn't say what rand is actually supposed to do. What is the purpose of providing a rand function if you have to supply a seed every single time. The seed has to be random, so where does that come from? Is the idea that you pass the same seed every time and get the next value from that seed's stream? Given the above functional and definitional problems I think the easiest course of action is to simply remove the mapping. Kris Jurka