Add btree indexing of boolean values

Don Baccus
This commit is contained in:
Bruce Momjian 2000-02-10 19:51:52 +00:00
parent ede72c2826
commit 7528fd2d52
8 changed files with 53 additions and 10 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.32 2000/01/28 17:23:47 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.33 2000/02/10 19:51:38 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@ -207,3 +207,9 @@ bttextcmp(struct varlena * a, struct varlena * b)
else
return 1;
}
int32
btboolcmp(bool a, bool b)
{
return (int32) ((uint8) a - (uint8) b);
}

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.21 2000/01/26 05:57:13 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.22 2000/02/10 19:51:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -119,6 +119,18 @@ boolgt(bool arg1, bool arg2)
return arg1 > arg2;
}
bool
boolle(bool arg1, bool arg2)
{
return arg1 <= arg2;
}
bool
boolge(bool arg1, bool arg2)
{
return arg1 >= arg2;
}
bool
istrue(bool arg1)
{

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_amop.h,v 1.29 2000/01/26 05:57:56 momjian Exp $
* $Id: pg_amop.h,v 1.30 2000/02/10 19:51:42 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -344,6 +344,16 @@ DATA(insert OID = 0 ( 403 1768 1752 3 ));
DATA(insert OID = 0 ( 403 1768 1757 4 ));
DATA(insert OID = 0 ( 403 1768 1756 5 ));
/*
* nbtree bool
*/
DATA(insert OID = 0 ( 403 1690 58 1 ));
DATA(insert OID = 0 ( 403 1690 1694 2 ));
DATA(insert OID = 0 ( 403 1690 91 3 ));
DATA(insert OID = 0 ( 403 1690 1695 4 ));
DATA(insert OID = 0 ( 403 1690 59 5 ));
/*
* hash table _ops
*/

View File

@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_amproc.h,v 1.19 2000/01/26 05:57:56 momjian Exp $
* $Id: pg_amproc.h,v 1.20 2000/02/10 19:51:45 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -99,6 +99,7 @@ DATA(insert OID = 0 (403 810 836 1));
DATA(insert OID = 0 (403 935 926 1));
DATA(insert OID = 0 (403 652 926 1));
DATA(insert OID = 0 (403 1768 1769 1));
DATA(insert OID = 0 (403 1690 1693 1));
/* hash */

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_opclass.h,v 1.27 2000/01/26 05:57:57 momjian Exp $
* $Id: pg_opclass.h,v 1.28 2000/02/10 19:51:45 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -118,5 +118,7 @@ DATA(insert OID = 652 ( cidr_ops 650 ));
DESCR("");
DATA(insert OID = 1768 ( numeric_ops 1700 ));
DESCR("");
DATA(insert OID = 1690 ( bool_ops 16 ));
DESCR("");
#endif /* PG_OPCLASS_H */

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_operator.h,v 1.66 2000/01/26 05:57:58 momjian Exp $
* $Id: pg_operator.h,v 1.67 2000/02/10 19:51:45 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -96,11 +96,13 @@ DATA(insert OID = 76 ( ">" PGUID 0 b t f 23 20 16 418 80 0 0 int48g
DATA(insert OID = 80 ( "<=" PGUID 0 b t f 23 20 16 430 76 0 0 int48le scalarltsel scalarltjoinsel ));
DATA(insert OID = 82 ( ">=" PGUID 0 b t f 23 20 16 420 37 0 0 int48ge scalargtsel scalargtjoinsel ));
DATA(insert OID = 58 ( "<" PGUID 0 b t f 16 16 16 59 0 0 0 boollt scalarltsel scalarltjoinsel ));
DATA(insert OID = 59 ( ">" PGUID 0 b t f 16 16 16 58 0 0 0 boolgt scalargtsel scalargtjoinsel ));
DATA(insert OID = 58 ( "<" PGUID 0 b t f 16 16 16 59 1695 0 0 boollt scalarltsel scalarltjoinsel ));
DATA(insert OID = 59 ( ">" PGUID 0 b t f 16 16 16 58 1694 0 0 boolgt scalargtsel scalargtjoinsel ));
DATA(insert OID = 85 ( "<>" PGUID 0 b t f 16 16 16 85 91 0 0 boolne neqsel neqjoinsel ));
DATA(insert OID = 91 ( "=" PGUID 0 b t t 16 16 16 91 85 58 58 booleq eqsel eqjoinsel ));
#define BooleanEqualOperator 91
DATA(insert OID = 1694 ( "<=" PGUID 0 b t f 16 16 16 1695 59 0 0 boolle scalarltsel scalarltjoinsel ));
DATA(insert OID = 1695 ( ">=" PGUID 0 b t f 16 16 16 1694 58 0 0 boolge scalargtsel scalargtjoinsel ));
DATA(insert OID = 92 ( "=" PGUID 0 b t t 18 18 16 92 630 631 631 chareq eqsel eqjoinsel ));
DATA(insert OID = 93 ( "=" PGUID 0 b t t 19 19 16 93 643 660 660 nameeq eqsel eqjoinsel ));

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_proc.h,v 1.119 2000/01/31 14:02:27 wieck Exp $
* $Id: pg_proc.h,v 1.120 2000/02/10 19:51:46 momjian Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@ -2230,6 +2230,13 @@ DESCR("host address");
DATA(insert OID = 683 ( network PGUID 11 f t t 1 f 25 "869" 100 0 0 100 network_network - ));
DESCR("network address");
DATA(insert OID = 1691 ( boolle PGUID 11 f t t 2 f 16 "16 16" 100 0 0 100 boolle - ));
DESCR("less-than-or-equal");
DATA(insert OID = 1692 ( boolge PGUID 11 f t t 2 f 16 "16 16" 100 0 0 100 boolge - ));
DESCR("greater-than-or-equal");
DATA(insert OID = 1693 ( btboolcmp PGUID 11 f t t 2 f 23 "16 16" 100 0 0 100 btboolcmp - ));
DESCR("btree less-equal-greater");
/* OID's 1700 - 1799 NUMERIC data type */
DATA(insert OID = 1701 ( numeric_in PGUID 11 f t t 3 f 1700 "0 0 23" 100 0 0 100 numeric_in - ));
DESCR("(internal)");

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: builtins.h,v 1.99 2000/01/26 05:58:37 momjian Exp $
* $Id: builtins.h,v 1.100 2000/02/10 19:51:52 momjian Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
@ -44,6 +44,8 @@ extern bool booleq(bool arg1, bool arg2);
extern bool boolne(bool arg1, bool arg2);
extern bool boollt(bool arg1, bool arg2);
extern bool boolgt(bool arg1, bool arg2);
extern bool boolle(bool arg1, bool arg2);
extern bool boolge(bool arg1, bool arg2);
extern bool istrue(bool arg1);
extern bool isfalse(bool arg1);
@ -181,6 +183,7 @@ extern int32 btabstimecmp(AbsoluteTime a, AbsoluteTime b);
extern int32 btcharcmp(char a, char b);
extern int32 btnamecmp(NameData *a, NameData *b);
extern int32 bttextcmp(struct varlena * a, struct varlena * b);
extern int32 btboolcmp(bool a, bool b);
/* support routines for the rtree access method, by opclass */
extern BOX *rt_box_union(BOX *a, BOX *b);