Re: Add test module for Table Access Method

2024-01-16 Thread Mats Kindahl
On Tue, Jan 16, 2024 at 6:15 AM Bharath Rupireddy <
bharath.rupireddyforpostg...@gmail.com> wrote:

> On Tue, Jan 16, 2024 at 10:28 AM Michael Paquier 
> wrote:
> >
> > Hmm.  I'd rather have it do something useful in terms of test coverage
> > rather than being just an empty skull.
> >
> > How about adding the same kind of coverage as dummy_index_am with a
> > couple of reloptions then?  That can serve as a point of reference
> > when a table AM needs a few custom options.  A second idea would be to
> > show how to use toast relations when implementing your new AM, where a
> > toast table could be created even in cases where we did not want one
> > with heap, when it comes to size limitations with char and/or varchar,
> > and that makes for a simpler needs_toast_table callback.
>
> I think a test module for a table AM will really help developers. Just
> to add to the above list - how about the table AM implementing a
> simple in-memory (columnar if possible) database storing tables
> in-memory and subsequently providing readers with the access to the
> tables?
>

Hi,

One idea I wanted to implement is a table access method that you can use to
test the interface, something like a "mock TAM" where you can
programmatically decide on the responses to unit-test the API. I was
thinking that you could implement a framework that allows you to implement
the TAM in some scripting language like Perl, Python, or (horrors) Tcl for
easy prototyping.

Best wishes,
Mats Kindahl


> --
> Bharath Rupireddy
> PostgreSQL Contributors Team
> RDS Open Source Databases
> Amazon Web Services: https://aws.amazon.com
>
>
>


Re: Add test module for Table Access Method

2024-01-16 Thread Mats Kindahl
Hi all,

On Tue, Jan 16, 2024 at 10:40 AM Aleksander Alekseev <
aleksan...@timescale.com> wrote:

> Hi,
>
> > > I think a test module for a table AM will really help developers. Just
> > > to add to the above list - how about the table AM implementing a
> > > simple in-memory (columnar if possible) database storing tables
> > > in-memory and subsequently providing readers with the access to the
> > > tables?
> >
> > That's a good idea.
>
> Personally I would be careful with this idea.
>
> Practice shows that when you show the first incomplete, limited and
> buggy PoC it ends up being in the production environment the next day
> :) In other words sooner or later there will be users demanding a full
> in-memory columnar storage support from Postgres. I believe it would
> be a problem. Last time I checked TAM was not extremely good for
> implementing proper columnar storages, and there are lots of open
> questions when it comes to in-memory tables (e.g. what to do with
> foreign keys, inherited tables, etc).
>
> All in all I don't think we should provide something that can look /
> be interpreted as first-class alternative storage but in fact is not.
>

I tossed together a table access method for in-memory storage in column
format for experimental purposes over the holidays (I actually have a
row-based one as well, but that is in no shape to share at this point).
It's available under https://github.com/mkindahl/pg_arrow. The intention
was mostly to have something simple to play and experiment with. It is
loosely based on the Apache Arrow Columnar format, but the normal data
structures are not suitable for storing in shared memory so I have tweaked
it a little.


> > How about adding the same kind of coverage as dummy_index_am with a
> > couple of reloptions then?  That can serve as a point of reference
> > when a table AM needs a few custom options.  A second idea would be to
> > show how to use toast relations when implementing your new AM, where a
> > toast table could be created even in cases where we did not want one
> > with heap, when it comes to size limitations with char and/or varchar,
> > and that makes for a simpler needs_toast_table callback.
>
> Good ideas. Additionally we could provide a proxy TAM for a heap TAM
> which does nothing but logging used TAM methods, its arguments and
> return values. This would be a good example and also potentially can
> be used as a debugging tool.
>

We wrote a table access method for experimenting with and to be able to
trace what happens while executing various statements. It is available
under https://github.com/timescale/pg_traceam for anybody who is interested.

Best wishes,
Mats Kindahl


>
> --
> Best regards,
> Aleksander Alekseev
>
>
>


Re: Add test module for Table Access Method

2024-01-16 Thread Aleksander Alekseev
Hi,

> > I think a test module for a table AM will really help developers. Just
> > to add to the above list - how about the table AM implementing a
> > simple in-memory (columnar if possible) database storing tables
> > in-memory and subsequently providing readers with the access to the
> > tables?
>
> That's a good idea.

Personally I would be careful with this idea.

Practice shows that when you show the first incomplete, limited and
buggy PoC it ends up being in the production environment the next day
:) In other words sooner or later there will be users demanding a full
in-memory columnar storage support from Postgres. I believe it would
be a problem. Last time I checked TAM was not extremely good for
implementing proper columnar storages, and there are lots of open
questions when it comes to in-memory tables (e.g. what to do with
foreign keys, inherited tables, etc).

All in all I don't think we should provide something that can look /
be interpreted as first-class alternative storage but in fact is not.

> How about adding the same kind of coverage as dummy_index_am with a
> couple of reloptions then?  That can serve as a point of reference
> when a table AM needs a few custom options.  A second idea would be to
> show how to use toast relations when implementing your new AM, where a
> toast table could be created even in cases where we did not want one
> with heap, when it comes to size limitations with char and/or varchar,
> and that makes for a simpler needs_toast_table callback.

Good ideas. Additionally we could provide a proxy TAM for a heap TAM
which does nothing but logging used TAM methods, its arguments and
return values. This would be a good example and also potentially can
be used as a debugging tool.

-- 
Best regards,
Aleksander Alekseev




Re: Add test module for Table Access Method

2024-01-15 Thread Japin Li


On Tue, 16 Jan 2024 at 13:15, Bharath Rupireddy 
 wrote:
> On Tue, Jan 16, 2024 at 10:28 AM Michael Paquier  wrote:
>>
>> Hmm.  I'd rather have it do something useful in terms of test coverage
>> rather than being just an empty skull.
>>
>> How about adding the same kind of coverage as dummy_index_am with a
>> couple of reloptions then?  That can serve as a point of reference
>> when a table AM needs a few custom options.  A second idea would be to
>> show how to use toast relations when implementing your new AM, where a
>> toast table could be created even in cases where we did not want one
>> with heap, when it comes to size limitations with char and/or varchar,
>> and that makes for a simpler needs_toast_table callback.
>
> I think a test module for a table AM will really help developers. Just
> to add to the above list - how about the table AM implementing a
> simple in-memory (columnar if possible) database storing tables
> in-memory and subsequently providing readers with the access to the
> tables?

That's a good idea.




Re: Add test module for Table Access Method

2024-01-15 Thread Bharath Rupireddy
On Tue, Jan 16, 2024 at 10:28 AM Michael Paquier  wrote:
>
> Hmm.  I'd rather have it do something useful in terms of test coverage
> rather than being just an empty skull.
>
> How about adding the same kind of coverage as dummy_index_am with a
> couple of reloptions then?  That can serve as a point of reference
> when a table AM needs a few custom options.  A second idea would be to
> show how to use toast relations when implementing your new AM, where a
> toast table could be created even in cases where we did not want one
> with heap, when it comes to size limitations with char and/or varchar,
> and that makes for a simpler needs_toast_table callback.

I think a test module for a table AM will really help developers. Just
to add to the above list - how about the table AM implementing a
simple in-memory (columnar if possible) database storing tables
in-memory and subsequently providing readers with the access to the
tables?

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com




Re: Add test module for Table Access Method

2024-01-15 Thread Michael Paquier
On Mon, Jan 15, 2024 at 03:40:30PM +0100, Jelte Fennema-Nio wrote:
> On Mon, 15 Jan 2024 at 14:26, Aleksander Alekseev
>  wrote:
>> To be fair, Postgres uses TAM internally, so there is at least one
>> complete and up-to-date real-life example.
> 
> Sure, but that one is quite hard to follow if you don't already know
> lots of details of the heap storage. At least for me, having a minimal
> example was extremely helpful and it made for a great code skeleton to
> start from.

Hmm.  I'd rather have it do something useful in terms of test coverage
rather than being just an empty skull.

How about adding the same kind of coverage as dummy_index_am with a
couple of reloptions then?  That can serve as a point of reference
when a table AM needs a few custom options.  A second idea would be to
show how to use toast relations when implementing your new AM, where a
toast table could be created even in cases where we did not want one
with heap, when it comes to size limitations with char and/or varchar,
and that makes for a simpler needs_toast_table callback.
--
Michaxel


signature.asc
Description: PGP signature


Re: Add test module for Table Access Method

2024-01-15 Thread Jelte Fennema-Nio
On Mon, 15 Jan 2024 at 14:26, Aleksander Alekseev
 wrote:
> To be fair, Postgres uses TAM internally, so there is at least one
> complete and up-to-date real-life example.

Sure, but that one is quite hard to follow if you don't already know
lots of details of the heap storage. At least for me, having a minimal
example was extremely helpful and it made for a great code skeleton to
start from.




Re: Add test module for Table Access Method

2024-01-15 Thread Aleksander Alekseev
Hi,

> When trying to implement a table access method in the past I remember
> very well that I was having a really hard time finding an example of
> one.

To be fair, Postgres uses TAM internally, so there is at least one
complete and up-to-date real-life example. Learning curve for TAMs is
indeed steep, and I wonder if we could do a better job in this respect
e.g. by providing a simpler example. This being said, I know several
people who learned TAM successfully (so far only for R tasks) which
indicates that its difficulty is adequate.

-- 
Best regards,
Aleksander Alekseev




Re: Add test module for Table Access Method

2024-01-15 Thread Jelte Fennema-Nio
On Thu, 28 Sept 2023 at 03:08, Michael Paquier  wrote:
> dummy_index_am has included from the start additional coverage for the
> various internal add_*_reloption routines, that were never covered in
> the core tree.  Except if I am missing something, I am not seeing some
> of the extra usefulness for the patch you've sent here.

When trying to implement a table access method in the past I remember
very well that I was having a really hard time finding an example of
one. I remember seeing the dummy_index_am module and being quite
disappointed that there wasn't a similar one for table access methods.
I believe that I eventually found blackhole_am, but it took me quite a
bit of mailing list spelunking to get there. So I think purely for
documentation purposes this addition would already be useful.




Re: Add test module for Table Access Method

2024-01-14 Thread vignesh C
On Thu, 28 Sept 2023 at 10:23, Michael Paquier  wrote:
>
> On Sat, Jun 03, 2023 at 07:42:36PM -0400, Fabrízio de Royes Mello wrote:
> > So in order to improve things a bit in this area I'm proposing to add a
> > test module for Table Access Method similar what we already have for Index
> > Access Method.
> >
> > This code is based on the "blackhole_am" implemented by Michael Paquier:
> > https://github.com/michaelpq/pg_plugins/tree/main/blackhole_am
>
> dummy_index_am has included from the start additional coverage for the
> various internal add_*_reloption routines, that were never covered in
> the core tree.  Except if I am missing something, I am not seeing some
> of the extra usefulness for the patch you've sent here.

I have changed the status of commitfest entry to "Returned with
Feedback" as Michael's comments have not yet been resolved. Please
handle the comments and update the commitfest entry accordingly.

Regards,
Vignesh




Re: Add test module for Table Access Method

2023-09-27 Thread Michael Paquier
On Sat, Jun 03, 2023 at 07:42:36PM -0400, Fabrízio de Royes Mello wrote:
> So in order to improve things a bit in this area I'm proposing to add a
> test module for Table Access Method similar what we already have for Index
> Access Method.
> 
> This code is based on the "blackhole_am" implemented by Michael Paquier:
> https://github.com/michaelpq/pg_plugins/tree/main/blackhole_am

dummy_index_am has included from the start additional coverage for the
various internal add_*_reloption routines, that were never covered in
the core tree.  Except if I am missing something, I am not seeing some
of the extra usefulness for the patch you've sent here.
--
Michael


signature.asc
Description: PGP signature


Re: Add test module for Table Access Method

2023-09-26 Thread Fabrízio de Royes Mello
On Mon, Jun 5, 2023 at 1:24 PM Fabrízio de Royes Mello <
fabriziome...@gmail.com> wrote:
>
> On Sat, Jun 3, 2023 at 7:42 PM Fabrízio de Royes Mello <
fabriziome...@gmail.com> wrote:
> >
> >
> > Hi all,
> >
> > During the PGCon Unconference session about Table Access Method one
missing item pointed out is that currently we lack documentation and
examples of TAM.
> >
> > So in order to improve things a bit in this area I'm proposing to add a
test module for Table Access Method similar what we already have for Index
Access Method.
> >
> > This code is based on the "blackhole_am" implemented by Michael
Paquier: https://github.com/michaelpq/pg_plugins/tree/main/blackhole_am
> >
>
> Just added some more tests, ran pgindent and also organized a bit some
comments and README.txt.
>

Rebased version.

-- 
Fabrízio de Royes Mello
From 5b6642b520874f4ca7023fc33d2e8e875fb64693 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabr=C3=ADzio=20de=20Royes=20Mello?=
 
Date: Sat, 3 Jun 2023 17:23:05 -0400
Subject: [PATCH v3] Add test module for Table Access Method

---
 src/test/modules/Makefile |   1 +
 src/test/modules/dummy_table_am/.gitignore|   3 +
 src/test/modules/dummy_table_am/Makefile  |  20 +
 src/test/modules/dummy_table_am/README|   5 +
 .../dummy_table_am/dummy_table_am--1.0.sql|  14 +
 .../modules/dummy_table_am/dummy_table_am.c   | 500 ++
 .../dummy_table_am/dummy_table_am.control |   5 +
 .../expected/dummy_table_am.out   | 207 
 src/test/modules/dummy_table_am/meson.build   |  33 ++
 .../dummy_table_am/sql/dummy_table_am.sql |  55 ++
 src/test/modules/meson.build  |   1 +
 11 files changed, 844 insertions(+)
 create mode 100644 src/test/modules/dummy_table_am/.gitignore
 create mode 100644 src/test/modules/dummy_table_am/Makefile
 create mode 100644 src/test/modules/dummy_table_am/README
 create mode 100644 src/test/modules/dummy_table_am/dummy_table_am--1.0.sql
 create mode 100644 src/test/modules/dummy_table_am/dummy_table_am.c
 create mode 100644 src/test/modules/dummy_table_am/dummy_table_am.control
 create mode 100644 src/test/modules/dummy_table_am/expected/dummy_table_am.out
 create mode 100644 src/test/modules/dummy_table_am/meson.build
 create mode 100644 src/test/modules/dummy_table_am/sql/dummy_table_am.sql

diff --git a/src/test/modules/Makefile b/src/test/modules/Makefile
index e81873cb5a..cb7a5b970a 100644
--- a/src/test/modules/Makefile
+++ b/src/test/modules/Makefile
@@ -10,6 +10,7 @@ SUBDIRS = \
 		  delay_execution \
 		  dummy_index_am \
 		  dummy_seclabel \
+		  dummy_table_am \
 		  libpq_pipeline \
 		  plsample \
 		  spgist_name_ops \
diff --git a/src/test/modules/dummy_table_am/.gitignore b/src/test/modules/dummy_table_am/.gitignore
new file mode 100644
index 00..44d119cfcc
--- /dev/null
+++ b/src/test/modules/dummy_table_am/.gitignore
@@ -0,0 +1,3 @@
+# Generated subdirectories
+/log/
+/results/
diff --git a/src/test/modules/dummy_table_am/Makefile b/src/test/modules/dummy_table_am/Makefile
new file mode 100644
index 00..9ea4a590c6
--- /dev/null
+++ b/src/test/modules/dummy_table_am/Makefile
@@ -0,0 +1,20 @@
+# src/test/modules/dummy_table_am/Makefile
+
+MODULES = dummy_table_am
+
+EXTENSION = dummy_table_am
+DATA = dummy_table_am--1.0.sql
+PGFILEDESC = "dummy_table_am - table access method template"
+
+REGRESS = dummy_table_am
+
+ifdef USE_PGXS
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
+else
+subdir = src/test/modules/dummy_table_am
+top_builddir = ../../../..
+include $(top_builddir)/src/Makefile.global
+include $(top_srcdir)/contrib/contrib-global.mk
+endif
diff --git a/src/test/modules/dummy_table_am/README b/src/test/modules/dummy_table_am/README
new file mode 100644
index 00..35211554b0
--- /dev/null
+++ b/src/test/modules/dummy_table_am/README
@@ -0,0 +1,5 @@
+Dummy Table AM
+==
+
+Dummy table AM is a module for testing any facility usable by an table
+access method, whose code is kept a maximum simple.
diff --git a/src/test/modules/dummy_table_am/dummy_table_am--1.0.sql b/src/test/modules/dummy_table_am/dummy_table_am--1.0.sql
new file mode 100644
index 00..aa0fd82e61
--- /dev/null
+++ b/src/test/modules/dummy_table_am/dummy_table_am--1.0.sql
@@ -0,0 +1,14 @@
+/* src/test/modules/dummy_table_am/dummy_table_am--1.0.sql */
+
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION dummy_table_am" to load this file. \quit
+
+CREATE FUNCTION dummy_table_am_handler(internal)
+RETURNS table_am_handler
+AS 'MODULE_PATHNAME'
+LANGUAGE C;
+
+-- Access method
+CREATE ACCESS METHOD dummy_table_am TYPE TABLE HANDLER dummy_table_am_handler;
+COMMENT ON ACCESS METHOD dummy_table_am IS 'dummy table access method';
+
diff --git a/src/test/modules/dum

Re: Add test module for Table Access Method

2023-06-05 Thread Fabrízio de Royes Mello
On Sat, Jun 3, 2023 at 7:42 PM Fabrízio de Royes Mello <
fabriziome...@gmail.com> wrote:
>
>
> Hi all,
>
> During the PGCon Unconference session about Table Access Method one
missing item pointed out is that currently we lack documentation and
examples of TAM.
>
> So in order to improve things a bit in this area I'm proposing to add a
test module for Table Access Method similar what we already have for Index
Access Method.
>
> This code is based on the "blackhole_am" implemented by Michael Paquier:
https://github.com/michaelpq/pg_plugins/tree/main/blackhole_am
>

Just added some more tests, ran pgindent and also organized a bit some
comments and README.txt.

Regards,

-- 
Fabrízio de Royes Mello
From 31d6bf00fbee6c229382db0760ba602e4d41c917 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabr=C3=ADzio=20de=20Royes=20Mello?=
 
Date: Sat, 3 Jun 2023 17:23:05 -0400
Subject: [PATCH v2] Add test module for Table Access Method

---
 src/test/modules/Makefile |   1 +
 src/test/modules/dummy_table_am/.gitignore|   3 +
 src/test/modules/dummy_table_am/Makefile  |  20 +
 src/test/modules/dummy_table_am/README|   5 +
 .../dummy_table_am/dummy_table_am--1.0.sql|  14 +
 .../modules/dummy_table_am/dummy_table_am.c   | 500 ++
 .../dummy_table_am/dummy_table_am.control |   5 +
 .../expected/dummy_table_am.out   | 207 
 src/test/modules/dummy_table_am/meson.build   |  33 ++
 .../dummy_table_am/sql/dummy_table_am.sql |  55 ++
 src/test/modules/meson.build  |   1 +
 11 files changed, 844 insertions(+)
 create mode 100644 src/test/modules/dummy_table_am/.gitignore
 create mode 100644 src/test/modules/dummy_table_am/Makefile
 create mode 100644 src/test/modules/dummy_table_am/README
 create mode 100644 src/test/modules/dummy_table_am/dummy_table_am--1.0.sql
 create mode 100644 src/test/modules/dummy_table_am/dummy_table_am.c
 create mode 100644 src/test/modules/dummy_table_am/dummy_table_am.control
 create mode 100644 src/test/modules/dummy_table_am/expected/dummy_table_am.out
 create mode 100644 src/test/modules/dummy_table_am/meson.build
 create mode 100644 src/test/modules/dummy_table_am/sql/dummy_table_am.sql

diff --git a/src/test/modules/Makefile b/src/test/modules/Makefile
index 6331c976dc..ce982b0e46 100644
--- a/src/test/modules/Makefile
+++ b/src/test/modules/Makefile
@@ -10,6 +10,7 @@ SUBDIRS = \
 		  delay_execution \
 		  dummy_index_am \
 		  dummy_seclabel \
+		  dummy_table_am \
 		  libpq_pipeline \
 		  plsample \
 		  snapshot_too_old \
diff --git a/src/test/modules/dummy_table_am/.gitignore b/src/test/modules/dummy_table_am/.gitignore
new file mode 100644
index 00..44d119cfcc
--- /dev/null
+++ b/src/test/modules/dummy_table_am/.gitignore
@@ -0,0 +1,3 @@
+# Generated subdirectories
+/log/
+/results/
diff --git a/src/test/modules/dummy_table_am/Makefile b/src/test/modules/dummy_table_am/Makefile
new file mode 100644
index 00..9ea4a590c6
--- /dev/null
+++ b/src/test/modules/dummy_table_am/Makefile
@@ -0,0 +1,20 @@
+# src/test/modules/dummy_table_am/Makefile
+
+MODULES = dummy_table_am
+
+EXTENSION = dummy_table_am
+DATA = dummy_table_am--1.0.sql
+PGFILEDESC = "dummy_table_am - table access method template"
+
+REGRESS = dummy_table_am
+
+ifdef USE_PGXS
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
+else
+subdir = src/test/modules/dummy_table_am
+top_builddir = ../../../..
+include $(top_builddir)/src/Makefile.global
+include $(top_srcdir)/contrib/contrib-global.mk
+endif
diff --git a/src/test/modules/dummy_table_am/README b/src/test/modules/dummy_table_am/README
new file mode 100644
index 00..35211554b0
--- /dev/null
+++ b/src/test/modules/dummy_table_am/README
@@ -0,0 +1,5 @@
+Dummy Table AM
+==
+
+Dummy table AM is a module for testing any facility usable by an table
+access method, whose code is kept a maximum simple.
diff --git a/src/test/modules/dummy_table_am/dummy_table_am--1.0.sql b/src/test/modules/dummy_table_am/dummy_table_am--1.0.sql
new file mode 100644
index 00..aa0fd82e61
--- /dev/null
+++ b/src/test/modules/dummy_table_am/dummy_table_am--1.0.sql
@@ -0,0 +1,14 @@
+/* src/test/modules/dummy_table_am/dummy_table_am--1.0.sql */
+
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION dummy_table_am" to load this file. \quit
+
+CREATE FUNCTION dummy_table_am_handler(internal)
+RETURNS table_am_handler
+AS 'MODULE_PATHNAME'
+LANGUAGE C;
+
+-- Access method
+CREATE ACCESS METHOD dummy_table_am TYPE TABLE HANDLER dummy_table_am_handler;
+COMMENT ON ACCESS METHOD dummy_table_am IS 'dummy table access method';
+
diff --git a/src/test/modules/dummy_table_am/dummy_table_am.c b/src/test/modules/dummy_table_am/dummy_table_am.c
new file mode 100644
index 00..132f7b18cd
--- /dev/null
+++

Add test module for Table Access Method

2023-06-03 Thread Fabrízio de Royes Mello
Hi all,

During the PGCon Unconference session about Table Access Method one missing
item pointed out is that currently we lack documentation and examples of
TAM.

So in order to improve things a bit in this area I'm proposing to add a
test module for Table Access Method similar what we already have for Index
Access Method.

This code is based on the "blackhole_am" implemented by Michael Paquier:
https://github.com/michaelpq/pg_plugins/tree/main/blackhole_am

Regards,

-- 
Fabrízio de Royes Mello
From 217b84f21ec1cdb0ede271d24b7a5863713db949 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabr=C3=ADzio=20de=20Royes=20Mello?=
 
Date: Sat, 3 Jun 2023 17:23:05 -0400
Subject: [PATCH] Add test module for Table Access Method

---
 src/test/modules/Makefile |   1 +
 src/test/modules/dummy_table_am/.gitignore|   3 +
 src/test/modules/dummy_table_am/Makefile  |  20 +
 src/test/modules/dummy_table_am/README|  12 +
 .../dummy_table_am/dummy_table_am--1.0.sql|  14 +
 .../modules/dummy_table_am/dummy_table_am.c   | 519 ++
 .../dummy_table_am/dummy_table_am.control |   5 +
 .../expected/dummy_table_am.out   | 127 +
 src/test/modules/dummy_table_am/meson.build   |  33 ++
 .../dummy_table_am/sql/dummy_table_am.sql |  34 ++
 src/test/modules/meson.build  |   1 +
 11 files changed, 769 insertions(+)
 create mode 100644 src/test/modules/dummy_table_am/.gitignore
 create mode 100644 src/test/modules/dummy_table_am/Makefile
 create mode 100644 src/test/modules/dummy_table_am/README
 create mode 100644 src/test/modules/dummy_table_am/dummy_table_am--1.0.sql
 create mode 100644 src/test/modules/dummy_table_am/dummy_table_am.c
 create mode 100644 src/test/modules/dummy_table_am/dummy_table_am.control
 create mode 100644 src/test/modules/dummy_table_am/expected/dummy_table_am.out
 create mode 100644 src/test/modules/dummy_table_am/meson.build
 create mode 100644 src/test/modules/dummy_table_am/sql/dummy_table_am.sql

diff --git a/src/test/modules/Makefile b/src/test/modules/Makefile
index 6331c976dc..ce982b0e46 100644
--- a/src/test/modules/Makefile
+++ b/src/test/modules/Makefile
@@ -10,6 +10,7 @@ SUBDIRS = \
 		  delay_execution \
 		  dummy_index_am \
 		  dummy_seclabel \
+		  dummy_table_am \
 		  libpq_pipeline \
 		  plsample \
 		  snapshot_too_old \
diff --git a/src/test/modules/dummy_table_am/.gitignore b/src/test/modules/dummy_table_am/.gitignore
new file mode 100644
index 00..44d119cfcc
--- /dev/null
+++ b/src/test/modules/dummy_table_am/.gitignore
@@ -0,0 +1,3 @@
+# Generated subdirectories
+/log/
+/results/
diff --git a/src/test/modules/dummy_table_am/Makefile b/src/test/modules/dummy_table_am/Makefile
new file mode 100644
index 00..9ea4a590c6
--- /dev/null
+++ b/src/test/modules/dummy_table_am/Makefile
@@ -0,0 +1,20 @@
+# src/test/modules/dummy_table_am/Makefile
+
+MODULES = dummy_table_am
+
+EXTENSION = dummy_table_am
+DATA = dummy_table_am--1.0.sql
+PGFILEDESC = "dummy_table_am - table access method template"
+
+REGRESS = dummy_table_am
+
+ifdef USE_PGXS
+PG_CONFIG = pg_config
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
+else
+subdir = src/test/modules/dummy_table_am
+top_builddir = ../../../..
+include $(top_builddir)/src/Makefile.global
+include $(top_srcdir)/contrib/contrib-global.mk
+endif
diff --git a/src/test/modules/dummy_table_am/README b/src/test/modules/dummy_table_am/README
new file mode 100644
index 00..61510f02fa
--- /dev/null
+++ b/src/test/modules/dummy_table_am/README
@@ -0,0 +1,12 @@
+Dummy Index AM
+==
+
+Dummy index AM is a module for testing any facility usable by an index
+access method, whose code is kept a maximum simple.
+
+This includes tests for all relation option types:
+- boolean
+- enum
+- integer
+- real
+- strings (with and without NULL as default)
diff --git a/src/test/modules/dummy_table_am/dummy_table_am--1.0.sql b/src/test/modules/dummy_table_am/dummy_table_am--1.0.sql
new file mode 100644
index 00..aa0fd82e61
--- /dev/null
+++ b/src/test/modules/dummy_table_am/dummy_table_am--1.0.sql
@@ -0,0 +1,14 @@
+/* src/test/modules/dummy_table_am/dummy_table_am--1.0.sql */
+
+-- complain if script is sourced in psql, rather than via CREATE EXTENSION
+\echo Use "CREATE EXTENSION dummy_table_am" to load this file. \quit
+
+CREATE FUNCTION dummy_table_am_handler(internal)
+RETURNS table_am_handler
+AS 'MODULE_PATHNAME'
+LANGUAGE C;
+
+-- Access method
+CREATE ACCESS METHOD dummy_table_am TYPE TABLE HANDLER dummy_table_am_handler;
+COMMENT ON ACCESS METHOD dummy_table_am IS 'dummy table access method';
+
diff --git a/src/test/modules/dummy_table_am/dummy_table_am.c b/src/test/modules/dummy_table_am/dummy_table_am.c
new file mode 100644
index 00..b299fe9c65
--- /dev/null
+++ b/src/test/modules/dummy_table_am/dummy_table_am.c
@@ -0,0 +1,519 @@
+/*