diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2005-07-01 13:44:56 +0000 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2005-07-01 13:44:56 +0000 |
commit | ef770cbb6913cc4c816bb09acd7cb13f996281bd (patch) | |
tree | fe973e6aeb9c018d54ea6267f49d5d1b2d5d2f95 /contrib/btree_gist/btree_text.c | |
parent | 8f6e8e8fed372a592f645d8900b6f456db82cc59 (diff) | |
download | postgresql-ef770cbb6913cc4c816bb09acd7cb13f996281bd.tar.gz postgresql-ef770cbb6913cc4c816bb09acd7cb13f996281bd.zip |
Fixes from Janko Richter <jankorichter@yahoo.de>
- Fix wrong index results on text, char, varchar for multibyte strings
- Fix some SIGFPE signals
- Add support for infinite timestamps
- Because of locale settings, btree_gist can not be a prefix index anymore (for text).
Each node holds now just the lower and upper boundary.
Diffstat (limited to 'contrib/btree_gist/btree_text.c')
-rw-r--r-- | contrib/btree_gist/btree_text.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/contrib/btree_gist/btree_text.c b/contrib/btree_gist/btree_text.c index d81e7d0fd92..1275df6aef7 100644 --- a/contrib/btree_gist/btree_text.c +++ b/contrib/btree_gist/btree_text.c @@ -62,11 +62,11 @@ gbt_textcmp(const bytea *a, const bytea *b) return DatumGetInt32(DirectFunctionCall2(bttextcmp, PointerGetDatum(a), PointerGetDatum(b))); } -static const gbtree_vinfo tinfo = +static gbtree_vinfo tinfo = { gbt_t_text, - TRUE, - TRUE, + 0, + FALSE, gbt_textgt, gbt_textge, gbt_texteq, @@ -77,7 +77,6 @@ static const gbtree_vinfo tinfo = }; - /************************************************** * Text ops **************************************************/ @@ -88,6 +87,11 @@ gbt_text_compress(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); + if ( tinfo.eml == 0 ) + { + tinfo.eml = pg_database_encoding_max_length(); + } + PG_RETURN_POINTER(gbt_var_compress(entry, &tinfo)); } @@ -98,6 +102,11 @@ gbt_bpchar_compress(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); GISTENTRY *retval; + if ( tinfo.eml == 0 ) + { + tinfo.eml = pg_database_encoding_max_length(); + } + if (entry->leafkey) { @@ -127,6 +136,11 @@ gbt_text_consistent(PG_FUNCTION_ARGS) bool retval = FALSE; GBT_VARKEY_R r = gbt_var_key_readable(key); + if ( tinfo.eml == 0 ) + { + tinfo.eml = pg_database_encoding_max_length(); + } + retval = gbt_var_consistent(&r, query, &strategy, GIST_LEAF(entry), &tinfo); PG_RETURN_BOOL(retval); @@ -144,6 +158,11 @@ gbt_bpchar_consistent(PG_FUNCTION_ARGS) bool retval; GBT_VARKEY_R r = gbt_var_key_readable(key); + if ( tinfo.eml == 0 ) + { + tinfo.eml = pg_database_encoding_max_length(); + } + retval = gbt_var_consistent(&r, trim, &strategy, GIST_LEAF(entry), &tinfo); PG_RETURN_BOOL(retval); } |