]> granicus.if.org Git - postgresql/commit
Restructure index access method API to hide most of it at the C level.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 18 Jan 2016 00:36:59 +0000 (19:36 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 18 Jan 2016 00:36:59 +0000 (19:36 -0500)
commit65c5fcd353a859da9e61bfb2b92a99f12937de3b
tree3d75be487f88d11a27fb0b96809e492838666d72
parent8d290c8ec6c182a4df1d089c21fe84c7912f01fe
Restructure index access method API to hide most of it at the C level.

This patch reduces pg_am to just two columns, a name and a handler
function.  All the data formerly obtained from pg_am is now provided
in a C struct returned by the handler function.  This is similar to
the designs we've adopted for FDWs and tablesample methods.  There
are multiple advantages.  For one, the index AM's support functions
are now simple C functions, making them faster to call and much less
error-prone, since the C compiler can now check function signatures.
For another, this will make it far more practical to define index access
methods in installable extensions.

A disadvantage is that SQL-level code can no longer see attributes
of index AMs; in particular, some of the crosschecks in the opr_sanity
regression test are no longer possible from SQL.  We've addressed that
by adding a facility for the index AM to perform such checks instead.
(Much more could be done in that line, but for now we're content if the
amvalidate functions more or less replace what opr_sanity used to do.)
We might also want to expose some sort of reporting functionality, but
this patch doesn't do that.

Alexander Korotkov, reviewed by Petr JelĂ­nek, and rather heavily
editorialized on by me.
93 files changed:
contrib/pageinspect/btreefuncs.c
contrib/pgstattuple/pgstatindex.c
contrib/pgstattuple/pgstattuple.c
doc/src/sgml/catalogs.sgml
doc/src/sgml/datatype.sgml
doc/src/sgml/indexam.sgml
doc/src/sgml/xindex.sgml
src/backend/access/brin/Makefile
src/backend/access/brin/brin.c
src/backend/access/brin/brin_validate.c [new file with mode: 0644]
src/backend/access/common/reloptions.c
src/backend/access/gin/Makefile
src/backend/access/gin/ginget.c
src/backend/access/gin/gininsert.c
src/backend/access/gin/ginscan.c
src/backend/access/gin/ginutil.c
src/backend/access/gin/ginvacuum.c
src/backend/access/gin/ginvalidate.c [new file with mode: 0644]
src/backend/access/gist/Makefile
src/backend/access/gist/gist.c
src/backend/access/gist/gistbuild.c
src/backend/access/gist/gistget.c
src/backend/access/gist/gistscan.c
src/backend/access/gist/gistutil.c
src/backend/access/gist/gistvacuum.c
src/backend/access/gist/gistvalidate.c [new file with mode: 0644]
src/backend/access/hash/Makefile
src/backend/access/hash/hash.c
src/backend/access/hash/hashutil.c
src/backend/access/hash/hashvalidate.c [new file with mode: 0644]
src/backend/access/index/Makefile
src/backend/access/index/amapi.c [new file with mode: 0644]
src/backend/access/index/indexam.c
src/backend/access/nbtree/Makefile
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtutils.c
src/backend/access/nbtree/nbtvalidate.c [new file with mode: 0644]
src/backend/access/spgist/Makefile
src/backend/access/spgist/spginsert.c
src/backend/access/spgist/spgscan.c
src/backend/access/spgist/spgutils.c
src/backend/access/spgist/spgvacuum.c
src/backend/access/spgist/spgvalidate.c [new file with mode: 0644]
src/backend/catalog/index.c
src/backend/catalog/objectaddress.c
src/backend/catalog/toasting.c
src/backend/commands/cluster.c
src/backend/commands/indexcmds.c
src/backend/commands/opclasscmds.c
src/backend/commands/tablecmds.c
src/backend/commands/typecmds.c
src/backend/executor/execAmi.c
src/backend/executor/nodeIndexscan.c
src/backend/nodes/outfuncs.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/util/plancat.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_utilcmd.c
src/backend/postmaster/autovacuum.c
src/backend/utils/adt/pseudotypes.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/cache/lsyscache.c
src/backend/utils/cache/relcache.c
src/backend/utils/cache/syscache.c
src/backend/utils/cache/typcache.c
src/backend/utils/sort/sortsupport.c
src/backend/utils/sort/tuplesort.c
src/include/access/amapi.h [new file with mode: 0644]
src/include/access/brin.h
src/include/access/brin_internal.h
src/include/access/gin_private.h
src/include/access/gist_private.h
src/include/access/gistscan.h
src/include/access/hash.h
src/include/access/nbtree.h
src/include/access/reloptions.h
src/include/access/spgist.h
src/include/catalog/catversion.h
src/include/catalog/pg_am.h
src/include/catalog/pg_proc.h
src/include/catalog/pg_type.h
src/include/nodes/nodes.h
src/include/nodes/relation.h
src/include/utils/builtins.h
src/include/utils/index_selfuncs.h [new file with mode: 0644]
src/include/utils/rel.h
src/include/utils/selfuncs.h
src/test/regress/expected/oidjoins.out
src/test/regress/expected/opr_sanity.out
src/test/regress/sql/oidjoins.sql
src/test/regress/sql/opr_sanity.sql
src/tools/findoidjoins/README