diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-10-17 22:10:30 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-10-17 22:10:30 +0000 |
| commit | e4fb8ff06a8aa1b4c073c46f63b7effd5885e327 (patch) | |
| tree | 870a38b1b82a5d72dd4bc63ec1270593f0d33936 /src/include | |
| parent | 2a64931c4bc76c5e800c3fb1eb5a18dc256899c9 (diff) | |
Add a new column to pg_am to specify whether an index AM supports backward
scanning; GiST and GIN do not, and it seems like too much trouble to make
them do so. By teaching ExecSupportsBackwardScan() about this restriction,
we ensure that the planner will protect a scroll cursor from the problem
by adding a Materialize node.
In passing, fix another longstanding bug in the same area: backwards scan of
a plan with set-returning functions in the targetlist did not work either,
since the TupFromTlist expansion code pays no attention to direction (and
has no way to run a SRF backwards anyway). Again the fix is to make
ExecSupportsBackwardScan check this restriction.
Also adjust the index AM API specification to note that mark/restore support
is unnecessary if the AM can't produce ordered output.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
| -rw-r--r-- | src/include/catalog/pg_am.h | 56 |
2 files changed, 31 insertions, 29 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index cd9d06f65d7..f242dcf469e 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.498 2008/10/14 17:12:33 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.499 2008/10/17 22:10:30 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200810141 +#define CATALOG_VERSION_NO 200810171 #endif diff --git a/src/include/catalog/pg_am.h b/src/include/catalog/pg_am.h index a7a638e083b..c2f4a49c760 100644 --- a/src/include/catalog/pg_am.h +++ b/src/include/catalog/pg_am.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_am.h,v 1.58 2008/09/15 18:43:41 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_am.h,v 1.59 2008/10/17 22:10:30 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -41,6 +41,7 @@ CATALOG(pg_am,2601) int2 amsupport; /* total number of support functions that this * AM uses */ bool amcanorder; /* does AM support ordered scan results? */ + bool amcanbackward; /* does AM support backward scan? */ bool amcanunique; /* does AM support UNIQUE indexes? */ bool amcanmulticol; /* does AM support multi-column indexes? */ bool amoptionalkey; /* can query omit key for the first column? */ @@ -75,48 +76,49 @@ typedef FormData_pg_am *Form_pg_am; * compiler constants for pg_am * ---------------- */ -#define Natts_pg_am 25 +#define Natts_pg_am 26 #define Anum_pg_am_amname 1 #define Anum_pg_am_amstrategies 2 #define Anum_pg_am_amsupport 3 #define Anum_pg_am_amcanorder 4 -#define Anum_pg_am_amcanunique 5 -#define Anum_pg_am_amcanmulticol 6 -#define Anum_pg_am_amoptionalkey 7 -#define Anum_pg_am_amindexnulls 8 -#define Anum_pg_am_amsearchnulls 9 -#define Anum_pg_am_amstorage 10 -#define Anum_pg_am_amclusterable 11 -#define Anum_pg_am_amkeytype 12 -#define Anum_pg_am_aminsert 13 -#define Anum_pg_am_ambeginscan 14 -#define Anum_pg_am_amgettuple 15 -#define Anum_pg_am_amgetbitmap 16 -#define Anum_pg_am_amrescan 17 -#define Anum_pg_am_amendscan 18 -#define Anum_pg_am_ammarkpos 19 -#define Anum_pg_am_amrestrpos 20 -#define Anum_pg_am_ambuild 21 -#define Anum_pg_am_ambulkdelete 22 -#define Anum_pg_am_amvacuumcleanup 23 -#define Anum_pg_am_amcostestimate 24 -#define Anum_pg_am_amoptions 25 +#define Anum_pg_am_amcanbackward 5 +#define Anum_pg_am_amcanunique 6 +#define Anum_pg_am_amcanmulticol 7 +#define Anum_pg_am_amoptionalkey 8 +#define Anum_pg_am_amindexnulls 9 +#define Anum_pg_am_amsearchnulls 10 +#define Anum_pg_am_amstorage 11 +#define Anum_pg_am_amclusterable 12 +#define Anum_pg_am_amkeytype 13 +#define Anum_pg_am_aminsert 14 +#define Anum_pg_am_ambeginscan 15 +#define Anum_pg_am_amgettuple 16 +#define Anum_pg_am_amgetbitmap 17 +#define Anum_pg_am_amrescan 18 +#define Anum_pg_am_amendscan 19 +#define Anum_pg_am_ammarkpos 20 +#define Anum_pg_am_amrestrpos 21 +#define Anum_pg_am_ambuild 22 +#define Anum_pg_am_ambulkdelete 23 +#define Anum_pg_am_amvacuumcleanup 24 +#define Anum_pg_am_amcostestimate 25 +#define Anum_pg_am_amoptions 26 /* ---------------- * initial contents of pg_am * ---------------- */ -DATA(insert OID = 403 ( btree 5 1 t t t t t t f t 0 btinsert btbeginscan btgettuple btgetbitmap btrescan btendscan btmarkpos btrestrpos btbuild btbulkdelete btvacuumcleanup btcostestimate btoptions )); +DATA(insert OID = 403 ( btree 5 1 t t t t t t t f t 0 btinsert btbeginscan btgettuple btgetbitmap btrescan btendscan btmarkpos btrestrpos btbuild btbulkdelete btvacuumcleanup btcostestimate btoptions )); DESCR("b-tree index access method"); #define BTREE_AM_OID 403 -DATA(insert OID = 405 ( hash 1 1 f f f f f f f f 23 hashinsert hashbeginscan hashgettuple hashgetbitmap hashrescan hashendscan hashmarkpos hashrestrpos hashbuild hashbulkdelete hashvacuumcleanup hashcostestimate hashoptions )); +DATA(insert OID = 405 ( hash 1 1 f t f f f f f f f 23 hashinsert hashbeginscan hashgettuple hashgetbitmap hashrescan hashendscan hashmarkpos hashrestrpos hashbuild hashbulkdelete hashvacuumcleanup hashcostestimate hashoptions )); DESCR("hash index access method"); #define HASH_AM_OID 405 -DATA(insert OID = 783 ( gist 0 7 f f t t t t t t 0 gistinsert gistbeginscan gistgettuple gistgetbitmap gistrescan gistendscan gistmarkpos gistrestrpos gistbuild gistbulkdelete gistvacuumcleanup gistcostestimate gistoptions )); +DATA(insert OID = 783 ( gist 0 7 f f f t t t t t t 0 gistinsert gistbeginscan gistgettuple gistgetbitmap gistrescan gistendscan gistmarkpos gistrestrpos gistbuild gistbulkdelete gistvacuumcleanup gistcostestimate gistoptions )); DESCR("GiST index access method"); #define GIST_AM_OID 783 -DATA(insert OID = 2742 ( gin 0 5 f f t t f f t f 0 gininsert ginbeginscan gingettuple gingetbitmap ginrescan ginendscan ginmarkpos ginrestrpos ginbuild ginbulkdelete ginvacuumcleanup gincostestimate ginoptions )); +DATA(insert OID = 2742 ( gin 0 5 f f f t t f f t f 0 gininsert ginbeginscan gingettuple gingetbitmap ginrescan ginendscan ginmarkpos ginrestrpos ginbuild ginbulkdelete ginvacuumcleanup gincostestimate ginoptions )); DESCR("GIN index access method"); #define GIN_AM_OID 2742 |
