From 8436489c81c23af637696ac69cdaafddcc907ee1 Mon Sep 17 00:00:00 2001
From: Tom Lane
Date: Wed, 2 Mar 2011 14:43:24 -0500
Subject: Add KNNGIST support to contrib/btree_gist.

This extends GiST's support for nearest-neighbor searches to many of the
standard data types.

Teodor Sigaev
---
 contrib/btree_gist/sql/interval.sql | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'contrib/btree_gist/sql/interval.sql')

diff --git a/contrib/btree_gist/sql/interval.sql b/contrib/btree_gist/sql/interval.sql
index 561e3d92ff9..0f8b0315203 100644
--- a/contrib/btree_gist/sql/interval.sql
+++ b/contrib/btree_gist/sql/interval.sql
@@ -16,6 +16,8 @@ SELECT count(*) FROM intervaltmp WHERE a >= '199 days 21:21:23';
 
 SELECT count(*) FROM intervaltmp WHERE a >  '199 days 21:21:23';
 
+SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21:21:23' LIMIT 3;
+
 CREATE INDEX intervalidx ON intervaltmp USING gist ( a );
 
 SET enable_seqscan=off;
@@ -29,3 +31,7 @@ SELECT count(*) FROM intervaltmp WHERE a  = '199 days 21:21:23'::interval;
 SELECT count(*) FROM intervaltmp WHERE a >= '199 days 21:21:23'::interval;
 
 SELECT count(*) FROM intervaltmp WHERE a >  '199 days 21:21:23'::interval;
+
+EXPLAIN (COSTS OFF)
+SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21:21:23' LIMIT 3;
+SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21:21:23' LIMIT 3;
-- 
cgit v1.2.3

