summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAndres Freund2019-04-05 00:17:50 +0000
committerAndres Freund2019-04-05 00:39:39 +0000
commitea97e440b8570ffd1a6cd6604f2ef882c0a72291 (patch)
tree97a95c62374d8cfa6ff2a8f1e539faf5314464be /src/include
parent344b7e11bbaf5e11f2497b11405e63d190043cfe (diff)
Harden tableam against nonexistant / wrong kind of AMs.
Previously it was allowed to set default_table_access_method to an empty string. That makes sense for default_tablespace, where that was copied from, as it signals falling back to the database's default tablespace. As there is no equivalent for table AMs, forbid that. Also make sure to throw a usable error when creating a table using an index AM, by using get_am_type_oid() to implement get_table_am_oid() instead of a separate copy. Previously we'd error out only later, in GetTableAmRoutine(). Thirdly remove GetTableAmRoutineByAmId() - it was only used in an earlier version of 8586bf7ed8. Add tests for the above (some for index AMs as well).
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/tableam.h1
-rw-r--r--src/include/commands/defrem.h1
2 files changed, 1 insertions, 1 deletions
diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h
index 90c329a88d3..a647e7db325 100644
--- a/src/include/access/tableam.h
+++ b/src/include/access/tableam.h
@@ -1616,7 +1616,6 @@ extern void table_block_parallelscan_startblock_init(Relation rel,
*/
extern const TableAmRoutine *GetTableAmRoutine(Oid amhandler);
-extern const TableAmRoutine *GetTableAmRoutineByAmId(Oid amoid);
extern const TableAmRoutine *GetHeapamTableAmRoutine(void);
extern bool check_default_table_access_method(char **newval, void **extra,
GucSource source);
diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h
index 7f49625987a..4003080323d 100644
--- a/src/include/commands/defrem.h
+++ b/src/include/commands/defrem.h
@@ -156,6 +156,7 @@ extern Datum transformGenericOptions(Oid catalogId,
extern ObjectAddress CreateAccessMethod(CreateAmStmt *stmt);
extern void RemoveAccessMethodById(Oid amOid);
extern Oid get_index_am_oid(const char *amname, bool missing_ok);
+extern Oid get_table_am_oid(const char *amname, bool missing_ok);
extern Oid get_am_oid(const char *amname, bool missing_ok);
extern char *get_am_name(Oid amOid);