Re: [PATCH] Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-08-04 Thread Peter Eisentraut
On lör, 2010-07-24 at 20:32 +0100, Mike Fowler wrote: Attached is the revised version of the patch addressing all the issues raised in the review, except for the use of AexprConst and c_expr. With my limited knowledge of bison I've failed to resolve the shift/reduce errors that are

Re: [PATCH] Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-07-24 Thread Mike Fowler
On 21/07/10 08:33, Mike Fowler wrote: Why is the first argument AexprConst instead of a_expr? The SQL standard says it's a character string literal, but I think we can very well allow arbitrary expressions. Yes, it was AexprConst because of the specification. I also found that using it solved

Re: [PATCH] Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-07-21 Thread Mike Fowler
Hi Peter, Thanks for your feedback. On 20/07/10 19:54, Peter Eisentraut wrote: 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

Re: [PATCH] Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-07-20 Thread Peter Eisentraut
On tis, 2010-06-29 at 12:22 +0100, Mike Fowler wrote: Mike Fowler wrote: 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

Re: [PATCH] Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-06-29 Thread Mike Fowler
Mike Fowler wrote: 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

[PATCH] Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-06-27 Thread Mike Fowler
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

Re: [PATCH] Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-06-27 Thread Robert Haas
On Sun, Jun 27, 2010 at 12:04 PM, Mike Fowler m...@mlfowler.com wrote: 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. Glad it was a helpful

Re: [PATCH] Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-06-27 Thread Mike Fowler
Robert Haas wrote: On Sun, Jun 27, 2010 at 12:04 PM, Mike Fowler m...@mlfowler.com wrote: 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.

Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-06-24 Thread Mike Fowler
Robert Haas wrote: I usually troubleshoot things like this by setting a breakpoint in elog_start or elog_finish. Then you can see where it's blowing up. Off the top of my head, I would guess you've added a node type whose structure definition doesn't begin with NodeTag, or else you've got a

Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-06-24 Thread Robert Haas
On Thu, Jun 24, 2010 at 2:37 PM, Mike Fowler m...@mlfowler.com wrote: Thanks Robert, I've managed to resolve this make making a type cast inside gram.y. However, it now seems that the function itself can not be found. I've made an entry in pg_proc.h, but when running psql I'm getting the

Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-06-22 Thread Mike Fowler
Look at how the POSITION() pseudofunction is defined around gram.y line 9651. Essentially any special syntax of this type gets converted to a regular function call internally. So in your case I think there will be some function that gets called something ike this: xmlexists(xpath_expression,

Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-06-22 Thread Robert Haas
On Tue, Jun 22, 2010 at 1:17 PM, Mike Fowler m...@mlfowler.com wrote: Look at how the POSITION() pseudofunction is defined around gram.y line 9651.  Essentially any special syntax of this type gets converted to a regular function call internally.  So in your case I think there will be some

[HACKERS] Adding XMLEXISTS to the grammar

2010-06-09 Thread Mike Fowler
Hi, I've been working to improve the syntax of the XMLEXISTS function that I put a patch forward for and have been attempting to get my head around how you modify the grammar. I admit I'm not getting much anywhere probably as I don't know bison but I'm starting to wonder if it's worth the

Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 6:32 AM, Mike Fowler m...@mlfowler.com wrote: I've been working to improve the syntax of the XMLEXISTS function that I put a patch forward for and have been attempting to get my head around how you modify the grammar. I admit I'm not getting much anywhere probably as I

Re: [HACKERS] Adding XMLEXISTS to the grammar

2010-06-09 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: Look at how the POSITION() pseudofunction is defined around gram.y line 9651. Essentially any special syntax of this type gets converted to a regular function call internally. So in your case I think there will be some function that gets called