[PATCH] Generic type subscription

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] Generic type subscription
Date: 2016-09-09 11:29:23
Message-ID: CA+q6zcVDuGBv=M0FqBYX8DPebS3F_0KQ6OVFobGJPM507_SZ_w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)mail(dot)gmail(dot)com#CA+q6zcV8qvGcDXurwwgUbwACV86Th7G80pnubg42e-p9gsSf=g@mail.gmail.com
[2]:
https://www.postgresql.org/message-id/flat/CA+q6zcX3mdxGCgdThzuySwH-ApyHHM-G4oB1R0fn0j2hZqqkLQ(at)mail(dot)gmail(dot)com#CA+q6zcX3mdxGCgdThzuySwH-ApyHHM-G4oB1R0fn0j2hZqqkLQ@mail.gmail.com

Attachment Content-Type Size
generic_type_subscription_v1.patch text/x-patch 203.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2016-09-09 11:55:40 Re: Tuplesort merge pre-reading
Previous Message Heikki Linnakangas 2016-09-09 11:13:49 Re: Tuplesort merge pre-reading