[PATCH] Generic type subscription
Dmitry Dolgov <9erthalion6@gmail.com>
From: Dmitry Dolgov <9erthalion6@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2016-09-09T11:29:23Z
Lists: pgsql-hackers
Attachments
- generic_type_subscription_v1.patch (text/x-patch) patch v1
Hi, Regarding to the previous conversations [1], [2], here is a patch (with some improvements from Nikita Glukhov) for the generic type subscription. It allows to define type-specific subscription logic for any data type and has implementations for the array and jsonb types. There are following changes in this patch: * A new column for `pg_type` (`regproc typsubscription`) which points out a type-specific subscription procedure for particular data type. It can be none (and it's a default value), which means that this data type doesn't support subscription. * Type-specific code (e.g. any kind of verification, type coercion, actual data extraction and update) in the array subscription implementation was separated from generic code into `array_subscription` procedure. Generic implementation assumes that subscription expression can be in form `[a]` or `[a:b]`, and there isn't any restrictions for type of `a` and `b`. * Using the same api a new subscription logic was implemented for `jsonb` type in `jsonb_subscription` procedure. Several changes were introduced into jsonb functions just to be able to share common code. I believe that this patch is more or less in good shape, so I would like to know what do you think about it? Feedback is welcome. [1]: https://www.postgresql.org/message-id/flat/CA+q6zcV8qvGcDXurwwgUbwACV86Th7G80pnubg42e-p9gsSf=g@mail.gmail.com#CA+q6zcV8qvGcDXurwwgUbwACV86Th7G80pnubg42e-p9gsSf=g@mail.gmail.com [2]: https://www.postgresql.org/message-id/flat/CA+q6zcX3mdxGCgdThzuySwH-ApyHHM-G4oB1R0fn0j2hZqqkLQ@mail.gmail.com#CA+q6zcX3mdxGCgdThzuySwH-ApyHHM-G4oB1R0fn0j2hZqqkLQ@mail.gmail.com
Commits
-
Throw error when assigning jsonb scalar instead of a composite object
- aa6e46daf530 14.0 landed
-
Filling array gaps during jsonb subscripting
- 81fcc72e6622 14.0 landed
-
Implementation of subscripting for jsonb
- 676887a3b0b8 14.0 landed
-
Support subscripting of arbitrary types, not only arrays.
- c7aba7c14efd 14.0 landed
-
Remove obsoleted code relating to targetlist SRF evaluation.
- ea15e18677fc 10.0 cited
-
Include <sys/select.h> where needed
- 51c3e9fade76 10.0 cited