Skip to content

Commit 951a923

Browse files
author
Nikita Glukhov
committed
Add jsonbc compression method
1 parent e46f24a commit 951a923

File tree

19 files changed

+2705
-88
lines changed

19 files changed

+2705
-88
lines changed

src/backend/catalog/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ POSTGRES_BKI_SRCS = $(addprefix $(top_srcdir)/src/include/catalog/,\
4545
pg_default_acl.h pg_init_privs.h pg_seclabel.h pg_shseclabel.h \
4646
pg_collation.h pg_partitioned_table.h pg_range.h pg_transform.h \
4747
pg_sequence.h pg_publication.h pg_publication_rel.h pg_subscription.h \
48-
pg_subscription_rel.h pg_compression.h toasting.h indexing.h \
48+
pg_subscription_rel.h pg_compression.h pg_jsonbc_dict.h \
4949
toasting.h indexing.h \
5050
)
5151

src/backend/catalog/dependency.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "catalog/pg_foreign_data_wrapper.h"
4242
#include "catalog/pg_foreign_server.h"
4343
#include "catalog/pg_init_privs.h"
44+
#include "catalog/pg_jsonbc_dict.h"
4445
#include "catalog/pg_language.h"
4546
#include "catalog/pg_largeobject.h"
4647
#include "catalog/pg_namespace.h"
@@ -81,6 +82,7 @@
8182
#include "storage/lmgr.h"
8283
#include "utils/fmgroids.h"
8384
#include "utils/guc.h"
85+
#include "utils/jsonbc_dict.h"
8486
#include "utils/lsyscache.h"
8587
#include "utils/syscache.h"
8688
#include "utils/tqual.h"
@@ -175,7 +177,8 @@ static const Oid object_classes[] = {
175177
PublicationRelRelationId, /* OCLASS_PUBLICATION_REL */
176178
SubscriptionRelationId, /* OCLASS_SUBSCRIPTION */
177179
TransformRelationId, /* OCLASS_TRANSFORM */
178-
CompressionMethodRelationId /* OCLASS_COMPRESSION_METHOD */
180+
CompressionMethodRelationId,/* OCLASS_COMPRESSION_METHOD */
181+
JsonbcDictionaryRelationId /* OCLASS_JSONBC_DICT */
179182
};
180183

181184

@@ -1275,6 +1278,10 @@ doDeletion(const ObjectAddress *object, int flags)
12751278
RemoveCompressionMethodById(object->objectId);
12761279
break;
12771280

1281+
case OCLASS_JSONBC_DICT:
1282+
jsonbcDictRemoveEntryById(object->objectId, object->objectSubId);
1283+
break;
1284+
12781285
default:
12791286
elog(ERROR, "unrecognized object class: %u",
12801287
object->classId);
@@ -2332,6 +2339,7 @@ getObjectClass(const ObjectAddress *object)
23322339
{
23332340
/* only pg_class entries can have nonzero objectSubId */
23342341
if (object->classId != RelationRelationId &&
2342+
object->classId != JsonbcDictionaryRelationId &&
23352343
object->objectSubId != 0)
23362344
elog(ERROR, "invalid non-zero objectSubId for object class %u",
23372345
object->classId);
@@ -2455,6 +2463,9 @@ getObjectClass(const ObjectAddress *object)
24552463

24562464
case CompressionMethodRelationId:
24572465
return OCLASS_COMPRESSION_METHOD;
2466+
2467+
case JsonbcDictionaryRelationId:
2468+
return OCLASS_JSONBC_DICT;
24582469
}
24592470

24602471
/* shouldn't get here */

src/backend/commands/event_trigger.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,7 @@ EventTriggerSupportsObjectClass(ObjectClass objclass)
11791179
case OCLASS_SUBSCRIPTION:
11801180
case OCLASS_STATISTIC_EXT:
11811181
case OCLASS_COMPRESSION_METHOD:
1182+
case OCLASS_JSONBC_DICT:
11821183
return true;
11831184
}
11841185

src/backend/parser/parse_clause.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "catalog/pg_am.h"
2525
#include "catalog/pg_collation.h"
2626
#include "catalog/pg_constraint_fn.h"
27+
#include "catalog/pg_jsonbc_dict.h"
2728
#include "catalog/pg_type.h"
2829
#include "commands/defrem.h"
2930
#include "nodes/makefuncs.h"
@@ -3116,7 +3117,8 @@ transformOnConflictArbiter(ParseState *pstate,
31163117
* To simplify certain aspects of its design, speculative insertion into
31173118
* system catalogs is disallowed
31183119
*/
3119-
if (IsCatalogRelation(pstate->p_target_relation))
3120+
if (IsCatalogRelation(pstate->p_target_relation) &&
3121+
pstate->p_target_relation->rd_id != JsonbcDictionaryRelationId)
31203122
ereport(ERROR,
31213123
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
31223124
errmsg("ON CONFLICT is not supported with system catalog tables"),

src/backend/utils/adt/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ OBJS = acl.o amutils.o arrayfuncs.o array_expanded.o array_selfuncs.o \
1717
geo_ops.o geo_selfuncs.o geo_spgist.o inet_cidr_ntop.o inet_net_pton.o \
1818
int.o int8.o json.o jsonb.o jsonb_gin.o jsonb_op.o jsonb_util.o \
1919
jsonfuncs.o json_generic.o json_gin.o json_op.o \
20+
jsonbc_util.o jsonbc_dict.o \
2021
like.o lockfuncs.o mac.o mac8.o misc.o nabstime.o name.o \
2122
network.o network_gist.o network_selfuncs.o network_spgist.o \
2223
numeric.o numutils.o oid.o oracle_compat.o \

0 commit comments

Comments
 (0)