Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 52FF59FA375 for ; Sat, 30 Sep 2006 05:43:48 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 32696-09 for ; Sat, 30 Sep 2006 08:43:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id F1EBD9FA298 for ; Sat, 30 Sep 2006 05:43:44 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from kitty.ukr.net (kitty.ukr.net [212.42.65.67]) by svr4.postgresql.org (Postfix) with ESMTP id 232D95AF03D for ; Sat, 30 Sep 2006 08:43:43 +0000 (GMT) Received: from mail by kitty.ukr.net with local ID 1GTaRg-0009G5-H9 for pgsql-sql@postgresql.org; Sat, 30 Sep 2006 11:43:40 +0300 Received: from [82.193.96.234] by e.ukr.net with HTTP; Sat, 30 Sep 2006 08:43:40 +0000 (GMT) From: "Alexander Ilyin" To: pgsql-sql@postgresql.org Reply-To: "Alexander Ilyin" Subject: How to FindNearest Mime-Version: 1.0 X-Mailer: mPOP Web-Mail 2.19 advanced X-Originating-IP: [82.193.96.234] Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: 8bit Message-Id: Date: Sat, 30 Sep 2006 11:43:40 +0300 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.567 tagged_above=0 required=5 tests=RATWARE_MPOP_WEBMAIL, RCVD_IN_SORBS_WEB X-Spam-Level: * X-Archive-Number: 200609/177 X-Sequence-Number: 26388 How to implement the functionality similar to the BDE/Paradox TTable.FindNearest? Suppose we have huge table. On the screen we need to show contents of that table in the Grid and under that Grid user can input in TextBox some letters. OnChange of this TextBox we need to make current row selection in the Grid on the row with value of some column nearest to the user input in the TextBox. How this can be implemented in PostgreSQL? At my first sight: I found there is CURSOR functionality which can move that cursor through the ResultSet. But we can move it just relatively phisical row number. Is there any chance to make cursor move to the row by some rule based on the row values? All possible approaches and ideas highly appreciated. There is just one requirement - the performance, it should work as fast as possible. Regards, Alexander Ilyin