Re: Add CREATE support to event triggers

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add CREATE support to event triggers
Date: 2014-10-31 02:27:52
Message-ID: CAB7nPqTP754LSDpNWi7mbaqE47-jUHdLa_BuKigwiEY2SA6SUQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 30, 2014 at 2:40 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Tue, Oct 28, 2014 at 6:00 AM, Andres Freund <andres(at)2ndquadrant(dot)com>
> wrote:
> >> Uhm. Obviously we didn't have jsonb when I started this and we do have
> >> them now, so I could perhaps see about updating the patch to do things
> >> this way; but I'm not totally sold on that idea, as my ObjTree stuff is
> >> a lot easier to manage and the jsonb API is pretty ugly.
> >
> > I looked at this as well, and I think trying to do so would not result
> > in readable code.
>
> That doesn't speak very well of jsonb. :-(
>

Just did the same and I played a bit with the APIs. And I am getting the
impression that the jsonb API is currently focused on the fact of deparsing
and parsing Jsonb strings to/from containers but there is no real interface
that allows to easily manipulate the containers where the values are
located. So, what I think is missing is really a friendly interface to
manipulate JsonbContainers directly, and I think that we are not far from
it with something like this set, roughly:
- Initialization of an empty container
- Set of APIs to directly push a value to a container (boolean, array,
null, string, numeric or other jsonb object)
- Initialization of JsonbValue objects
With this basic set of APIs patch 4 could for example use JsonbToCString to
then convert the JSONB bucket back to a string it sends to client. Note as
well that there is already findJsonbValueFromContainer present to get back
a value in a container.

In short, my point is: instead of re-creating the wheel like what this
series of patch is trying to do with ObjTree, I think that it would be more
fruitful to have a more solid in-place JSONB infrastructure that allows to
directly manipulate JSONB objects. This feature as well as future
extensions could benefit from that.
Feel free to comment.
Regards,
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2014-10-31 02:29:32 Re: TAP test breakage on MacOS X
Previous Message Fabrízio de Royes Mello 2014-10-31 02:12:58 Re: CREATE IF NOT EXISTS INDEX