From: | Mike Fowler <mike(at)mlfowler(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | [PATCH] Re: Adding XMLEXISTS to the grammar |
Date: | 2010-06-27 16:04:47 |
Message-ID: | 4C27769F.80408@mlfowler.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>> and finally in pg_proc.h I have:
>>
>> DATA(insert OID = 3037 ( xmlexists PGNSP PGUID 12 1 0 0 f f f t f i 3 0
>> 16 "25 142" _null_ _null_ _null_ _null_ xml_exists _null_ _null_ _null_ ));
>> DESCR("evaluate XPath expression in a boolean context");
>>
> It looks like the pg_proc entry is creating an SQL function called
> xmlexists referencing a C function called xml_exists, and the gram.y
> changes want there to be an SQL function called xml_exists. I think
> you should rip out all the catalog and parser changes for starters,
> and just try to get it working as a regular old function. Once you
> have that working, you can add the syntax support back in. I'd
> suggest making the C and SQL function names the same as each other,
> but different from the keyword you're planning to use (xmlexists).
>
Thanks again for your help Robert, turns out the fault was in the
pg_proc entry (the 3 up there should've been a two!). Once I took the
grammar out it was quickly obvious where I'd gone wrong.
Attached is a patch with the revised XMLEXISTS function, complete with
grammar support and regression tests. The implemented grammar is:
XMLEXISTS ( xpath_expression PASSING BY REF xml_value [BY REF] )
Though the full grammar makes everything after the xpath_expression
optional, I've left it has mandatory simply to avoid lots of rework of
the function (would need new null checks, memory handling would need
reworking).
--
Mike Fowler
Registered Linux user: 379787
Attachment | Content-Type | Size |
---|---|---|
xmlexists-4.patch | text/x-diff | 14.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Fowler | 2010-06-27 16:09:21 | [PATCH] Re: Adding xpath_exists function |
Previous Message | Tom Lane | 2010-06-27 14:26:48 | Re: Why are these modules built without respecting my LDFLAGS? |