~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to contrib/btree_gist/btree_ts.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $PostgreSQL: pgsql/contrib/btree_gist/btree_ts.c,v 1.16 2008/05/17 01:28:19 adunstan Exp $ 
 
2
 * $PostgreSQL: pgsql/contrib/btree_gist/btree_ts.c,v 1.17 2009/06/11 14:48:50 momjian Exp $
3
3
 */
4
4
#include "btree_gist.h"
5
5
#include "btree_utils_num.h"
9
9
{
10
10
        Timestamp       lower;
11
11
        Timestamp       upper;
12
 
}       tsKEY;
 
12
} tsKEY;
13
13
 
14
14
/*
15
15
** timestamp ops
192
192
        GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
193
193
        Timestamp       query = PG_GETARG_TIMESTAMP(1);
194
194
        StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
 
195
 
195
196
        /* Oid          subtype = PG_GETARG_OID(3); */
196
197
        bool       *recheck = (bool *) PG_GETARG_POINTER(4);
197
198
        tsKEY      *kkk = (tsKEY *) DatumGetPointer(entry->key);
200
201
        /* All cases served by this function are exact */
201
202
        *recheck = false;
202
203
 
203
 
        key.lower = (GBT_NUMKEY *) & kkk->lower;
204
 
        key.upper = (GBT_NUMKEY *) & kkk->upper;
 
204
        key.lower = (GBT_NUMKEY *) &kkk->lower;
 
205
        key.upper = (GBT_NUMKEY *) &kkk->upper;
205
206
 
206
207
        PG_RETURN_BOOL(
207
208
                                   gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)
212
213
gbt_tstz_consistent(PG_FUNCTION_ARGS)
213
214
{
214
215
        GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
215
 
        TimestampTz     query = PG_GETARG_TIMESTAMPTZ(1);
 
216
        TimestampTz query = PG_GETARG_TIMESTAMPTZ(1);
216
217
        StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
 
218
 
217
219
        /* Oid          subtype = PG_GETARG_OID(3); */
218
220
        bool       *recheck = (bool *) PG_GETARG_POINTER(4);
219
221
        char       *kkk = (char *) DatumGetPointer(entry->key);
223
225
        /* All cases served by this function are exact */
224
226
        *recheck = false;
225
227
 
226
 
        key.lower = (GBT_NUMKEY *) & kkk[0];
227
 
        key.upper = (GBT_NUMKEY *) & kkk[MAXALIGN(tinfo.size)];
 
228
        key.lower = (GBT_NUMKEY *) &kkk[0];
 
229
        key.upper = (GBT_NUMKEY *) &kkk[MAXALIGN(tinfo.size)];
228
230
        qqq = tstz_to_ts_gmt(query);
229
231
 
230
232
        PG_RETURN_BOOL(