pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Harden tableam against nonexistant / wrong kind of AMs.
Date: Fri, 05 Apr 2019 00:43:50 +0000
Message-ID: <E1hCCxS-0006lM-PV@gemulon.postgresql.org> (raw)

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).

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ea97e440b8570ffd1a6cd6604f2ef882c0a72291

Modified Files
--------------
src/backend/access/table/tableamapi.c     | 110 +++++-------------------------
src/backend/commands/amcmds.c             |  10 +++
src/backend/commands/tablecmds.c          |  17 +----
src/include/access/tableam.h              |   1 -
src/include/commands/defrem.h             |   1 +
src/test/regress/expected/create_am.out   |  33 +++++++++
src/test/regress/expected/type_sanity.out |  18 +++++
src/test/regress/sql/create_am.sql        |  27 ++++++++
src/test/regress/sql/type_sanity.sql      |  12 ++++
9 files changed, 119 insertions(+), 110 deletions(-)



Message-ID: <E1hCCxS-0006lM-PV@gemulon.postgresql.org>
Permalink:  ../E1hCCxS-0006lM-PV@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hCCxS-0006lM-PV@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: Harden tableam against nonexistant / wrong kind of AMs.
  In-Reply-To: <E1hCCxS-0006lM-PV@gemulon.postgresql.org>
  References: <E1hCCxS-0006lM-PV@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox