~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to contrib/btree_gist/expected/date.out

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- date check
 
2
CREATE TABLE datetmp (a date);
 
3
\copy datetmp from 'data/date.data'
 
4
SET enable_seqscan=on;
 
5
SELECT count(*) FROM datetmp WHERE a <  '2001-02-13';
 
6
 count 
 
7
-------
 
8
   230
 
9
(1 row)
 
10
 
 
11
SELECT count(*) FROM datetmp WHERE a <= '2001-02-13';
 
12
 count 
 
13
-------
 
14
   231
 
15
(1 row)
 
16
 
 
17
SELECT count(*) FROM datetmp WHERE a  = '2001-02-13';
 
18
 count 
 
19
-------
 
20
     1
 
21
(1 row)
 
22
 
 
23
SELECT count(*) FROM datetmp WHERE a >= '2001-02-13';
 
24
 count 
 
25
-------
 
26
   314
 
27
(1 row)
 
28
 
 
29
SELECT count(*) FROM datetmp WHERE a >  '2001-02-13';
 
30
 count 
 
31
-------
 
32
   313
 
33
(1 row)
 
34
 
 
35
SELECT a, a <-> '2001-02-13' FROM datetmp ORDER BY a <-> '2001-02-13' LIMIT 3;
 
36
     a      | ?column? 
 
37
------------+----------
 
38
 02-13-2001 |        0
 
39
 02-11-2001 |        2
 
40
 03-24-2001 |       39
 
41
(3 rows)
 
42
 
 
43
CREATE INDEX dateidx ON datetmp USING gist ( a );
 
44
SET enable_seqscan=off;
 
45
SELECT count(*) FROM datetmp WHERE a <  '2001-02-13'::date;
 
46
 count 
 
47
-------
 
48
   230
 
49
(1 row)
 
50
 
 
51
SELECT count(*) FROM datetmp WHERE a <= '2001-02-13'::date;
 
52
 count 
 
53
-------
 
54
   231
 
55
(1 row)
 
56
 
 
57
SELECT count(*) FROM datetmp WHERE a  = '2001-02-13'::date;
 
58
 count 
 
59
-------
 
60
     1
 
61
(1 row)
 
62
 
 
63
SELECT count(*) FROM datetmp WHERE a >= '2001-02-13'::date;
 
64
 count 
 
65
-------
 
66
   314
 
67
(1 row)
 
68
 
 
69
SELECT count(*) FROM datetmp WHERE a >  '2001-02-13'::date;
 
70
 count 
 
71
-------
 
72
   313
 
73
(1 row)
 
74
 
 
75
EXPLAIN (COSTS OFF)
 
76
SELECT a, a <-> '2001-02-13' FROM datetmp ORDER BY a <-> '2001-02-13' LIMIT 3;
 
77
                  QUERY PLAN                  
 
78
----------------------------------------------
 
79
 Limit
 
80
   ->  Index Scan using dateidx on datetmp
 
81
         Order By: (a <-> '02-13-2001'::date)
 
82
(3 rows)
 
83
 
 
84
SELECT a, a <-> '2001-02-13' FROM datetmp ORDER BY a <-> '2001-02-13' LIMIT 3;
 
85
     a      | ?column? 
 
86
------------+----------
 
87
 02-13-2001 |        0
 
88
 02-11-2001 |        2
 
89
 03-24-2001 |       39
 
90
(3 rows)
 
91