Re: patch: function xmltable

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch: function xmltable
Date: 2017-01-15 06:29:22
Message-ID: CAFj8pRA_KEukOBXvS4V-imoEEsXu0pD0AsHV0-MwRFDRWte8Lg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2017-01-14 14:43 GMT+01:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:

> Hi
>
> 2017-01-13 21:32 GMT+01:00 Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>:
>
>> Pavel Stehule wrote:
>> >
>> > I used your proposed way based on Restarget
>>
>> Thanks. Some more tweaking to go yet before I consider this
>> committable, but it's much better now. Here's v28. I changed a few
>> things:
>>
>> - make expression evaluation code more orthodox:
>> 1. avoid PG_TRY, use a ExprContext shutdown callback instead
>> 2. use a "Fast" evaluator, for calls past the first one
>> 3. don't look up fmgrinfos until execution time
>> 4. don't duplicate get_expr_result_type
>> - make parser accept DEFAULT namespace. Only xml implementation barfs.
>> (this means we lost the errposition pointer, but I don't really
>> care. We could fix it if we cared)
>> - clean up parse analysis code a little bit
>> - move decls/struct defs to better locations in source code
>> - remove leftover "namespaces" in TableExprState
>> - pgindent the whole mess.
>>
>>
> I checked the changes and looks correct - although for some I had not
> courage :) - like dynamic change of exprstate->evalfunc
>
> I fixed test, and append forgotten header file
>
>
>
>
>> I don't like the xml.c code and the "evalcols" flag. That's next on my
>> list to fix.
>>
>
> You need some flag to specify if column paths are valid or not.
>
>
>> I don't think to_xmlstr() is necessary, considering xml_text2xmlChar.
>> We could just apply a cast of the source cstring to xmlChar.
>>
>
> is it safe? For one byte encodings?
>

Looks so this patch breaks regression tests

estoring database schemas in the new cluster
\"\ cdefghijklmnopqrstuvwxyz{|}~

regression
*failure*

Consult the last few lines of "pg_upgrade_dump_16387.log" for
the probable cause of the failure.
Failure, exiting
+ rm -rf /tmp/pg_upgrade_check-wSfzCh
Makefile:39: návod pro cíl „check“ selhal
make[2]: *** [check] Chyba 1
make[2]: Opouští se adresář „/home/pavel/src/postgresql/src/bin/pg_upgrade“

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 496; 1259 47693 VIEW
xmltableview2 pavel
pg_restore: [archiver (db)] could not execute query: ERROR: syntax error
at or near "("
LINE 15: ...XMLTABLE(XMLNAMESPACES('http://x.y'::"text" AS zz)('/zz:rows...

Fixed in attached patch

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

Attachment Content-Type Size
xmltable-30.patch text/x-patch 163.5 KB
diff.patch text/x-patch 454 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gilles Darold 2017-01-15 10:11:44 Re: Patch to implement pg_current_logfile() function
Previous Message Pavel Stehule 2017-01-15 06:27:42 proposal: enhanced stack trace for PL - print param args