Skip to content

Commit e5adf3b

Browse files
author
Nikita Malakhov
committed
Pluggable TOAST API interface along with reference TOAST mechanics
Reference TOAST mechanics is very limited in terms of using internal knowledge on TOASTed data structure or workload. It is not extensible and is a part of Heap AM. Pluggable TOAST suggests extensible TOAST API which allows to develop and plug in different TOAST mechanics for disting table columns and even data types. Pluggable TOAST API is introduced along with the default (reference) TOAST mechanics which is left untouched in this patch. Pluggable TOAST API consists of 3 parts: 1) SQL syntax supports manipulations with toasters - CREATE TABLE ... (column type STORAGE storage_type TOASTER toaster), ALTER TABLE ALTER COLUMN column SET TOASTER toaster and Toaster definition. TOAST API requires earlier patch with CREATE TABLE SET STORAGE clause; New column atttoaster is added to pg_attribute. Toaster drop is not allowed for not to lose already toasted data; 2) New VARATT_CUSTOM data structure with fixed header and variable tail to store custom toasted data, with according macros set; 3) Toaster handler routine structure contains custom toaster functions. Along with necessary functions custom toasters could implement other functions which are stored into vtable; In this patch regular (default) TOAST function is left as-is and not yet implemented via new API. More detailed documentation is provided in /src/backend/access/README.toastapi TOAST API syntax and code explanation provided in additional docs patch. Author: Teodor Sigaev <teodor@sigaev.ru> Author: Oleg Bartunov <obartunov@postgrespro.ru> Author: Nikita Glukhov <n.gluhov@postgrespro.ru> Author: Nikita Malakhov <n.malakhov@postgrespro.ru> Discussion: https://www.postgresql.org/message-id/flat/224711f9-83b7-a307-b17f-4457ab73aa0a@sigaev.ru
1 parent 3161ae8 commit e5adf3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2911
-773
lines changed

contrib/test_decoding/expected/ddl.out

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -484,12 +484,12 @@ CREATE TABLE replication_metadata (
484484
WITH (user_catalog_table = true)
485485
;
486486
\d+ replication_metadata
487-
Table "public.replication_metadata"
488-
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
489-
----------+---------+-----------+----------+--------------------------------------------------+----------+--------------+-------------
490-
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | |
491-
relation | name | | not null | | plain | |
492-
options | text[] | | | | extended | |
487+
Table "public.replication_metadata"
488+
Column | Type | Collation | Nullable | Default | Storage | Toaster | Stats target | Description
489+
----------+---------+-----------+----------+--------------------------------------------------+----------+------------+--------------+-------------
490+
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | | |
491+
relation | name | | not null | | plain | | |
492+
options | text[] | | | | extended | deftoaster | |
493493
Indexes:
494494
"replication_metadata_pkey" PRIMARY KEY, btree (id)
495495
Options: user_catalog_table=true
@@ -498,25 +498,25 @@ INSERT INTO replication_metadata(relation, options)
498498
VALUES ('foo', ARRAY['a', 'b']);
499499
ALTER TABLE replication_metadata RESET (user_catalog_table);
500500
\d+ replication_metadata
501-
Table "public.replication_metadata"
502-
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
503-
----------+---------+-----------+----------+--------------------------------------------------+----------+--------------+-------------
504-
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | |
505-
relation | name | | not null | | plain | |
506-
options | text[] | | | | extended | |
501+
Table "public.replication_metadata"
502+
Column | Type | Collation | Nullable | Default | Storage | Toaster | Stats target | Description
503+
----------+---------+-----------+----------+--------------------------------------------------+----------+------------+--------------+-------------
504+
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | | |
505+
relation | name | | not null | | plain | | |
506+
options | text[] | | | | extended | deftoaster | |
507507
Indexes:
508508
"replication_metadata_pkey" PRIMARY KEY, btree (id)
509509

510510
INSERT INTO replication_metadata(relation, options)
511511
VALUES ('bar', ARRAY['a', 'b']);
512512
ALTER TABLE replication_metadata SET (user_catalog_table = true);
513513
\d+ replication_metadata
514-
Table "public.replication_metadata"
515-
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
516-
----------+---------+-----------+----------+--------------------------------------------------+----------+--------------+-------------
517-
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | |
518-
relation | name | | not null | | plain | |
519-
options | text[] | | | | extended | |
514+
Table "public.replication_metadata"
515+
Column | Type | Collation | Nullable | Default | Storage | Toaster | Stats target | Description
516+
----------+---------+-----------+----------+--------------------------------------------------+----------+------------+--------------+-------------
517+
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | | |
518+
relation | name | | not null | | plain | | |
519+
options | text[] | | | | extended | deftoaster | |
520520
Indexes:
521521
"replication_metadata_pkey" PRIMARY KEY, btree (id)
522522
Options: user_catalog_table=true
@@ -529,13 +529,13 @@ ALTER TABLE replication_metadata ALTER COLUMN rewritemeornot TYPE text;
529529
ERROR: cannot rewrite table "replication_metadata" used as a catalog table
530530
ALTER TABLE replication_metadata SET (user_catalog_table = false);
531531
\d+ replication_metadata
532-
Table "public.replication_metadata"
533-
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
534-
----------------+---------+-----------+----------+--------------------------------------------------+----------+--------------+-------------
535-
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | |
536-
relation | name | | not null | | plain | |
537-
options | text[] | | | | extended | |
538-
rewritemeornot | integer | | | | plain | |
532+
Table "public.replication_metadata"
533+
Column | Type | Collation | Nullable | Default | Storage | Toaster | Stats target | Description
534+
----------------+---------+-----------+----------+--------------------------------------------------+----------+------------+--------------+-------------
535+
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | | |
536+
relation | name | | not null | | plain | | |
537+
options | text[] | | | | extended | deftoaster | |
538+
rewritemeornot | integer | | | | plain | | |
539539
Indexes:
540540
"replication_metadata_pkey" PRIMARY KEY, btree (id)
541541
Options: user_catalog_table=false

0 commit comments

Comments
 (0)