Re: [HACKERS] patch: function xmltable

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: [HACKERS] patch: function xmltable
Дата
Msg-id CAFj8pRB6Ei-0YG+15WpLLNP8-dt+-K0p6zYBG_0HTMmXha7_BA@mail.gmail.com
обсуждение исходный текст
Ответы Re: [HACKERS] patch: function xmltable  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Hi

2017-01-16 23:51 GMT+01:00 Alvaro Herrera <alvherre@2ndquadrant.com>:
Given
https://www.postgresql.org/message-id/20170116210019.a3glfwspg5lnfrnm@alap3.anarazel.de
which is going to heavily change how the executor works in this area, I
am returning this patch to you again.  I would like a few rather minor
changes:

1. to_xmlstr can be replaced with calls to xmlCharStrdup.

I checked this idea, and it doesn't look well - xmlCharStrdup created xml string in own memory - and it should be explicitly released with xmlFree(). In this case is more practical using PostgreSQL memory context - because this memory is released safely in exception. I can rename this function to more conventional pg_xmlCharStrndup. This function can be used more time in current code.
 
2. don't need xml_xmlnodetostr either -- just use xml_xmlnodetoxmltype
   (which returns text*) and extract the cstring from the varlena.  It's
   a bit more wasteful in terms of cycles, but I don't think we care.
   If we do care, change the function so that it returns cstring, and
   have the callers that want text wrap it in cstring_to_text.

done - it is related to not too often use case, and possible slowdown is minimal
 
3. have a new perValueCxt memcxt in TableExprState, child of buildercxt,
   and switch to it just before GetValue() (reset it just before
   switching).  Then, don't worry about leaks in GetValue.  This way,
   the text* conversions et al don't matter.

done
 

After that I think we're going to need to get this working on top of
Andres' changes.  Which I'm afraid is going to be rather major surgery,
but I haven't looked.

I am waiting on new commits in this area. This moment I have not idea what will be broken.

attached updated patch with cleaned xml part

Regards

Pavel 

--
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Вложения

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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: [HACKERS] Re: Clarifying "server starting" messaging in pg_ctlstart without --wait
Следующее
От: "Karl O. Pinc"
Дата:
Сообщение: Re: [HACKERS] Patch to implement pg_current_logfile() function