Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit eb5d44a

Browse files
author
Nikita Glukhov
committed
Add TAPAS storage
1 parent 2bf1d79 commit eb5d44a

File tree

8 files changed

+15
-3
lines changed

8 files changed

+15
-3
lines changed

src/backend/access/brin/brin_tuple.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ brin_form_tuple(BrinDesc *brdesc, BlockNumber blkno, BrinMemTuple *tuple,
219219
if (!VARATT_IS_EXTENDED(DatumGetPointer(value)) &&
220220
VARSIZE(DatumGetPointer(value)) > TOAST_INDEX_TARGET &&
221221
(atttype->typstorage == TYPSTORAGE_EXTENDED ||
222+
atttype->typstorage == TYPSTORAGE_TAPAS ||
222223
atttype->typstorage == TYPSTORAGE_MAIN))
223224
{
224225
Datum cvalue;

src/backend/access/common/indextuple.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ index_form_tuple(TupleDesc tupleDescriptor,
101101
if (!VARATT_IS_EXTENDED(DatumGetPointer(untoasted_values[i])) &&
102102
VARSIZE(DatumGetPointer(untoasted_values[i])) > TOAST_INDEX_TARGET &&
103103
(att->attstorage == TYPSTORAGE_EXTENDED ||
104+
att->attstorage == TYPSTORAGE_TAPAS ||
104105
att->attstorage == TYPSTORAGE_MAIN))
105106
{
106107
Datum cvalue;

src/backend/commands/tablecmds.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,6 +2099,8 @@ storage_name(char c)
20992099
return "EXTENDED";
21002100
case TYPSTORAGE_MAIN:
21012101
return "MAIN";
2102+
case TYPSTORAGE_TAPAS:
2103+
return "TAPAS";
21022104
default:
21032105
return "???";
21042106
}
@@ -7941,6 +7943,8 @@ ATExecSetStorage(Relation rel, const char *colName, Node *newValue, LOCKMODE loc
79417943
newstorage = TYPSTORAGE_EXTENDED;
79427944
else if (pg_strcasecmp(storagemode, "main") == 0)
79437945
newstorage = TYPSTORAGE_MAIN;
7946+
else if (pg_strcasecmp(storagemode, "tapas") == 0)
7947+
newstorage = TYPSTORAGE_TAPAS;
79447948
else
79457949
{
79467950
ereport(ERROR,

src/backend/commands/typecmds.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,8 @@ DefineType(ParseState *pstate, List *names, List *parameters)
447447
storage = TYPSTORAGE_EXTENDED;
448448
else if (pg_strcasecmp(a, "main") == 0)
449449
storage = TYPSTORAGE_MAIN;
450+
else if (pg_strcasecmp(a, "tapas") == 0)
451+
storage = TYPSTORAGE_TAPAS;
450452
else
451453
ereport(ERROR,
452454
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -4145,6 +4147,8 @@ AlterType(AlterTypeStmt *stmt)
41454147
atparams.storage = TYPSTORAGE_EXTENDED;
41464148
else if (pg_strcasecmp(a, "main") == 0)
41474149
atparams.storage = TYPSTORAGE_MAIN;
4150+
else if (pg_strcasecmp(a, "tapas") == 0)
4151+
atparams.storage = TYPSTORAGE_TAPAS;
41484152
else
41494153
ereport(ERROR,
41504154
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),

src/bin/psql/describe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2107,7 +2107,8 @@ describeOneTableDetails(const char *schemaname,
21072107
(storage[0] == 'm' ? "main" :
21082108
(storage[0] == 'x' ? "extended" :
21092109
(storage[0] == 'e' ? "external" :
2110-
"???")))),
2110+
(storage[0] == 't' ? "tapas" :
2111+
"???"))))),
21112112
false, false);
21122113
}
21132114

src/include/catalog/pg_type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ DECLARE_UNIQUE_INDEX(pg_type_typname_nsp_index, 2704, on pg_type using btree(typ
306306
#define TYPSTORAGE_EXTERNAL 'e' /* toastable, don't try to compress */
307307
#define TYPSTORAGE_EXTENDED 'x' /* fully toastable */
308308
#define TYPSTORAGE_MAIN 'm' /* like 'x' but try to store inline */
309+
#define TYPSTORAGE_TAPAS 't' /* store compressed chunks, first chunk inlined */
309310

310311
/* Is a type OID a polymorphic pseudotype? (Beware of multiple evaluation) */
311312
#define IsPolymorphicType(typid) \

src/test/regress/expected/type_sanity.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ WHERE p1.typnamespace = 0 OR
2020
(p1.typtype not in ('b', 'c', 'd', 'e', 'p', 'r', 'm')) OR
2121
NOT p1.typisdefined OR
2222
(p1.typalign not in ('c', 's', 'i', 'd')) OR
23-
(p1.typstorage not in ('p', 'x', 'e', 'm'));
23+
(p1.typstorage not in ('p', 'x', 'e', 'm', 't'));
2424
oid | typname
2525
-----+---------
2626
(0 rows)

src/test/regress/sql/type_sanity.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ WHERE p1.typnamespace = 0 OR
2323
(p1.typtype not in ('b', 'c', 'd', 'e', 'p', 'r', 'm')) OR
2424
NOT p1.typisdefined OR
2525
(p1.typalign not in ('c', 's', 'i', 'd')) OR
26-
(p1.typstorage not in ('p', 'x', 'e', 'm'));
26+
(p1.typstorage not in ('p', 'x', 'e', 'm', 't'));
2727

2828
-- Look for "pass by value" types that can't be passed by value.
2929

0 commit comments

Comments
 (0)