Allow GIN's extractQuery method to signal that nothing can satisfy the query.
Teodor Sigaev <teodor@sigaev.ru>
Allow GIN's extractQuery method to signal that nothing can satisfy the query. In this case extractQuery should returns -1 as nentries. This changes prototype of extractQuery method to use int32* instead of uint32* for nentries argument. Based on that gincostestimate may see two corner cases: nothing will be found or seqscan should be used. Per proposal at http://archives.postgresql.org/pgsql-hackers/2007-01/msg01581.php PS tsearch_core patch should be sightly modified to support changes, but I'm waiting a verdict about reviewing of tsearch_core patch.
Files
| Path | Change | +/− |
|---|---|---|
| contrib/intarray/_int_gin.c | modified | +14 −1 |
| contrib/tsearch2/ginidx.c | modified | +5 −3 |
| doc/src/sgml/gin.sgml | modified | +9 −3 |
| src/backend/access/gin/ginarrayproc.c | modified | +17 −2 |
| src/backend/access/gin/ginbulk.c | modified | +3 −3 |
| src/backend/access/gin/ginget.c | modified | +10 −3 |
| src/backend/access/gin/gininsert.c | modified | +3 −3 |
| src/backend/access/gin/ginscan.c | modified | +14 −3 |
| src/backend/access/gin/ginutil.c | modified | +3 −3 |
| src/backend/utils/adt/selfuncs.c | modified | +115 −1 |
| src/include/access/gin.h | modified | +6 −4 |