From 58b7ad96a866faa048754492bd269fe41c46436f Mon Sep 17 00:00:00 2001 From: teodor Date: Tue, 27 Dec 2011 12:25:52 +0000 Subject: [PATCH] 9.2devel support --- expected/gevel.out.9.2 | 406 +++++++++++++++++++++++++++++++++++++++++ gevel.c | 8 + gevel.sql.in | 14 +- 3 files changed, 421 insertions(+), 7 deletions(-) create mode 100644 expected/gevel.out.9.2 diff --git a/expected/gevel.out.9.2 b/expected/gevel.out.9.2 new file mode 100644 index 0000000..26cb1d1 --- /dev/null +++ b/expected/gevel.out.9.2 @@ -0,0 +1,406 @@ +SET client_min_messages = warning; +\set ECHO none +RESET client_min_messages; +CREATE TABLE gevelt ( t box ); +\copy gevelt from 'data/rect.data' +CREATE INDEX gist_idx ON gevelt USING gist ( t ); +--GiST +SELECT gist_stat('gist_idx'); + gist_stat +----------------------------------------- + Number of levels: 2 + + Number of pages: 29 + + Number of leaf pages: 28 + + Number of tuples: 3406 + + Number of invalid tuples: 0 + + Number of leaf tuples: 3378 + + Total size of tuples: 143516 bytes+ + Total size of leaf tuples: 142296 bytes+ + Total size of index: 237568 bytes+ + +(1 row) + +SELECT gist_tree('gist_idx'); + gist_tree +----------------------------------------------------------------------------------------------- + 0(l:0) blk: 0 numTuple: 28 free: 6940b(14.95%) rightlink:4294967295 (InvalidBlockNumber) + + 1(l:1) blk: 2 numTuple: 278 free: 2588b(68.28%) rightlink:4294967295 (InvalidBlockNumber)+ + 2(l:1) blk: 19 numTuple: 123 free: 2736b(66.47%) rightlink:3 (OK) + + 3(l:1) blk: 8 numTuple: 128 free: 2516b(69.17%) rightlink:22 (OK) + + 4(l:1) blk: 4 numTuple: 92 free: 4100b(49.75%) rightlink:23 (OK) + + 5(l:1) blk: 20 numTuple: 122 free: 2780b(65.93%) rightlink:7 (OK) + + 6(l:1) blk: 15 numTuple: 127 free: 2560b(68.63%) rightlink:11 (OK) + + 7(l:1) blk: 12 numTuple: 118 free: 2956b(63.77%) rightlink:17 (OK) + + 8(l:1) blk: 18 numTuple: 138 free: 2076b(74.56%) rightlink:9 (OK) + + 9(l:1) blk: 23 numTuple: 126 free: 2604b(68.09%) rightlink:8 (OK) + + 10(l:1) blk: 10 numTuple: 156 free: 1284b(84.26%) rightlink:19 (OK) + + 11(l:1) blk: 13 numTuple: 130 free: 2428b(70.25%) rightlink:20 (OK) + + 12(l:1) blk: 22 numTuple: 112 free: 3220b(60.54%) rightlink:10 (OK) + + 13(l:1) blk: 16 numTuple: 89 free: 4232b(48.14%) rightlink:25 (OK) + + 14(l:1) blk: 25 numTuple: 108 free: 3396b(58.38%) rightlink:5 (OK) + + 15(l:1) blk: 7 numTuple: 99 free: 3792b(53.53%) rightlink:16 (OK) + + 16(l:1) blk: 6 numTuple: 122 free: 2780b(65.93%) rightlink:18 (OK) + + 17(l:1) blk: 14 numTuple: 163 free: 976b(88.04%) rightlink:6 (OK) + + 18(l:1) blk: 27 numTuple: 122 free: 2780b(65.93%) rightlink:12 (OK) + + 19(l:1) blk: 3 numTuple: 57 free: 5640b(30.88%) rightlink:26 (OK) + + 20(l:1) blk: 24 numTuple: 58 free: 5596b(31.42%) rightlink:15 (OK) + + 21(l:1) blk: 9 numTuple: 128 free: 2516b(69.17%) rightlink:24 (OK) + + 22(l:1) blk: 21 numTuple: 166 free: 844b(89.66%) rightlink:13 (OK) + + 23(l:1) blk: 26 numTuple: 124 free: 2692b(67.01%) rightlink:14 (OK) + + 24(l:1) blk: 11 numTuple: 146 free: 1724b(78.87%) rightlink:2 (OK) + + 25(l:1) blk: 17 numTuple: 64 free: 5332b(34.66%) rightlink:28 (OK) + + 26(l:1) blk: 5 numTuple: 61 free: 5464b(33.04%) rightlink:27 (OK) + + 27(l:1) blk: 1 numTuple: 92 free: 4100b(49.75%) rightlink:21 (OK) + + 28(l:1) blk: 28 numTuple: 129 free: 2472b(69.71%) rightlink:4 (OK) + + +(1 row) + +SELECT * FROM gist_print('gist_idx') as t(level int, valid bool, a box) where level=1; + level | valid | a +-------+-------+----------------------------- + 1 | t | + 1 | t | (32261,50040),(20397,42779) + 1 | t | (20400,41715),(9175,31485) + 1 | t | (8924,39250),(3,31083) + 1 | t | (20594,19151),(10869,10535) + 1 | t | (49981,42533),(43290,28026) + 1 | t | (32512,19729),(20838,11843) + 1 | t | (49999,27727),(40603,15778) + 1 | t | (8993,50012),(64,39781) + 1 | t | (32394,42395),(20513,31557) + 1 | t | (20715,10161),(10407,51) + 1 | t | (20327,49975),(9216,42130) + 1 | t | (13397,31188),(7334,19288) + 1 | t | (20856,31294),(13642,19263) + 1 | t | (6986,30859),(107,19466) + 1 | t | (40397,28538),(32515,15759) + 1 | t | (49985,15380),(42047,43) + 1 | t | (32715,11509),(24675,6) + 1 | t | (41916,5154),(32914,357) + 1 | t | (43056,42360),(32661,37729) + 1 | t | (42941,37586),(32606,28547) + 1 | t | (10104,18999),(15,7761) + 1 | t | (41835,15752),(32828,5360) + 1 | t | (50027,50073),(32453,42694) + 1 | t | (24855,31262),(21146,19925) + 1 | t | (24423,11473),(20828,181) + 1 | t | (10146,7495),(138,81) + 1 | t | (32511,31225),(25000,19942) +(28 rows) + +CREATE TABLE test__int( a int[] ); +\copy test__int from 'data/test__int.data' +CREATE INDEX gin_idx ON test__int USING gin ( a ); +INSERT INTO test__int ( SELECT ARRAY[t] || '{1000}'::_int4 FROM generate_series (1,300) as t ); +INSERT INTO test__int ( SELECT ARRAY[t] || '{1001}'::_int4 FROM generate_series (1,300) as t, generate_series(1,12) ); +VACUUM ANALYZE test__int; +SELECT * FROM gin_stat('gin_idx') as t(value int, nrow int); + value | nrow +-------+------ + 0 | 38 + 1 | 257 + 2 | 244 + 3 | 222 + 4 | 228 + 5 | 227 + 6 | 243 + 7 | 238 + 8 | 236 + 9 | 224 + 10 | 236 + 11 | 248 + 12 | 224 + 13 | 235 + 14 | 237 + 15 | 253 + 16 | 234 + 17 | 245 + 18 | 246 + 19 | 234 + 20 | 236 + 21 | 213 + 22 | 235 + 23 | 222 + 24 | 197 + 25 | 253 + 26 | 218 + 27 | 239 + 28 | 198 + 29 | 244 + 30 | 247 + 31 | 267 + 32 | 234 + 33 | 209 + 34 | 231 + 35 | 218 + 36 | 242 + 37 | 232 + 38 | 221 + 39 | 232 + 40 | 241 + 41 | 239 + 42 | 221 + 43 | 211 + 44 | 231 + 45 | 213 + 46 | 236 + 47 | 264 + 48 | 221 + 49 | 235 + 50 | 219 + 51 | 250 + 52 | 270 + 53 | 222 + 54 | 242 + 55 | 237 + 56 | 237 + 57 | 251 + 58 | 231 + 59 | 272 + 60 | 219 + 61 | 233 + 62 | 235 + 63 | 260 + 64 | 252 + 65 | 221 + 66 | 228 + 67 | 253 + 68 | 196 + 69 | 232 + 70 | 232 + 71 | 223 + 72 | 247 + 73 | 214 + 74 | 232 + 75 | 229 + 76 | 233 + 77 | 221 + 78 | 227 + 79 | 233 + 80 | 216 + 81 | 244 + 82 | 223 + 83 | 254 + 84 | 227 + 85 | 247 + 86 | 255 + 87 | 239 + 88 | 258 + 89 | 249 + 90 | 244 + 91 | 226 + 92 | 225 + 93 | 230 + 94 | 218 + 95 | 232 + 96 | 239 + 97 | 226 + 98 | 209 + 99 | 211 + 100 | 216 + 101 | 49 + 102 | 47 + 103 | 59 + 104 | 55 + 105 | 48 + 106 | 49 + 107 | 49 + 108 | 51 + 109 | 47 + 110 | 51 + 111 | 45 + 112 | 46 + 113 | 48 + 114 | 38 + 115 | 39 + 116 | 43 + 117 | 44 + 118 | 46 + 119 | 45 + 120 | 52 + 121 | 41 + 122 | 64 + 123 | 50 + 124 | 41 + 125 | 55 + 126 | 41 + 127 | 50 + 128 | 54 + 129 | 43 + 130 | 44 + 131 | 50 + 132 | 57 + 133 | 40 + 134 | 41 + 135 | 44 + 136 | 58 + 137 | 48 + 138 | 44 + 139 | 50 + 140 | 49 + 141 | 48 + 142 | 43 + 143 | 36 + 144 | 43 + 145 | 49 + 146 | 46 + 147 | 40 + 148 | 52 + 149 | 46 + 150 | 49 + 151 | 42 + 152 | 58 + 153 | 49 + 154 | 51 + 155 | 49 + 156 | 45 + 157 | 53 + 158 | 59 + 159 | 38 + 160 | 53 + 161 | 48 + 162 | 41 + 163 | 40 + 164 | 52 + 165 | 50 + 166 | 40 + 167 | 48 + 168 | 45 + 169 | 49 + 170 | 50 + 171 | 45 + 172 | 46 + 173 | 47 + 174 | 41 + 175 | 51 + 176 | 50 + 177 | 41 + 178 | 42 + 179 | 48 + 180 | 47 + 181 | 49 + 182 | 40 + 183 | 46 + 184 | 52 + 185 | 36 + 186 | 45 + 187 | 41 + 188 | 47 + 189 | 49 + 190 | 46 + 191 | 45 + 192 | 39 + 193 | 50 + 194 | 39 + 195 | 54 + 196 | 43 + 197 | 50 + 198 | 46 + 199 | 42 + 200 | 31 + 201 | 28 + 202 | 28 + 203 | 28 + 204 | 30 + 205 | 22 + 206 | 25 + 207 | 27 + 208 | 32 + 209 | 22 + 210 | 21 + 211 | 31 + 212 | 22 + 213 | 37 + 214 | 19 + 215 | 25 + 216 | 27 + 217 | 26 + 218 | 24 + 219 | 25 + 220 | 26 + 221 | 21 + 222 | 23 + 223 | 20 + 224 | 26 + 225 | 25 + 226 | 25 + 227 | 23 + 228 | 30 + 229 | 30 + 230 | 24 + 231 | 22 + 232 | 27 + 233 | 27 + 234 | 21 + 235 | 27 + 236 | 24 + 237 | 24 + 238 | 29 + 239 | 32 + 240 | 31 + 241 | 24 + 242 | 36 + 243 | 21 + 244 | 29 + 245 | 22 + 246 | 23 + 247 | 21 + 248 | 26 + 249 | 29 + 250 | 24 + 251 | 29 + 252 | 25 + 253 | 28 + 254 | 25 + 255 | 19 + 256 | 23 + 257 | 20 + 258 | 24 + 259 | 31 + 260 | 29 + 261 | 20 + 262 | 25 + 263 | 23 + 264 | 25 + 265 | 23 + 266 | 31 + 267 | 22 + 268 | 26 + 269 | 33 + 270 | 25 + 271 | 27 + 272 | 29 + 273 | 29 + 274 | 26 + 275 | 28 + 276 | 30 + 277 | 28 + 278 | 29 + 279 | 22 + 280 | 29 + 281 | 23 + 282 | 30 + 283 | 29 + 284 | 23 + 285 | 37 + 286 | 27 + 287 | 31 + 288 | 28 + 289 | 26 + 290 | 25 + 291 | 29 + 292 | 22 + 293 | 26 + 294 | 29 + 295 | 24 + 296 | 27 + 297 | 30 + 298 | 29 + 299 | 26 + 300 | 13 + 1000 | 300 + 1001 | 4074 + | 9 + | 244 +(305 rows) + diff --git a/gevel.c b/gevel.c index 269ece9..86fb43e 100644 --- a/gevel.c +++ b/gevel.c @@ -58,7 +58,11 @@ PG_MODULE_MAGIC; static Relation gist_index_open(RangeVar *relvar) { +#if PG_VERSION_NUM < 90100 Oid relOid = RangeVarGetRelid(relvar, false); +#else + Oid relOid = RangeVarGetRelid(relvar, NoLock, false); +#endif return checkOpenedRelation( index_open(relOid, AccessExclusiveLock), GIST_AM_OID); } @@ -67,7 +71,11 @@ gist_index_open(RangeVar *relvar) { static Relation gin_index_open(RangeVar *relvar) { +#if PG_VERSION_NUM < 90100 Oid relOid = RangeVarGetRelid(relvar, false); +#else + Oid relOid = RangeVarGetRelid(relvar, NoLock, false); +#endif return checkOpenedRelation( index_open(relOid, AccessShareLock), GIN_AM_OID); } diff --git a/gevel.sql.in b/gevel.sql.in index 4a71188..48691f8 100644 --- a/gevel.sql.in +++ b/gevel.sql.in @@ -4,43 +4,43 @@ BEGIN; create or replace function gist_tree(text) returns text as 'MODULE_PATHNAME' - language 'C' + language C with (isstrict); create or replace function gist_tree(text,int4) returns text as 'MODULE_PATHNAME' - language 'C' + language C with (isstrict); create or replace function gist_stat(text) returns text as 'MODULE_PATHNAME' - language 'C' + language C with (isstrict); create or replace function gist_print(text) returns setof record as 'MODULE_PATHNAME' - language 'C' + language C with (isstrict); create or replace function gin_stat(text) returns setof record as 'MODULE_PATHNAME' - language 'C' + language C with (isstrict); create or replace function gin_stat(text, int) returns setof record as 'MODULE_PATHNAME' - language 'C' + language C with (isstrict); create or replace function gin_count_estimate(text, tsquery) returns bigint as 'MODULE_PATHNAME' - language 'C' + language C with (isstrict); -- 2.46.1