Re: Add CREATE support to event triggers

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Add CREATE support to event triggers
Дата
Msg-id CAB7nPqTP754LSDpNWi7mbaqE47-jUHdLa_BuKigwiEY2SA6SUQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Add CREATE support to event triggers  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Add CREATE support to event triggers  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
On Thu, Oct 30, 2014 at 2:40 AM, Robert Haas <robertmhaas@gmail.com> wrote:
On Tue, Oct 28, 2014 at 6:00 AM, Andres Freund <andres@2ndquadrant.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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fabrízio de Royes Mello
Дата:
Сообщение: Re: CREATE IF NOT EXISTS INDEX
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: TAP test breakage on MacOS X