Re: Adding XMLEXISTS to the grammar

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Mike Fowler <mike(at)mlfowler(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding XMLEXISTS to the grammar
Date: 2010-06-22 17:37:30
Message-ID: AANLkTimJHUw__GGiTfzWhltKodE_zGExmw_OT8m48QBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 22, 2010 at 1:17 PM, Mike Fowler <mike(at)mlfowler(dot)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 function that gets called something ike this:
>>
>> xmlexists(xpath_expression, xml_expression)
>>
>> ...but the grammar can be modified to allow a different syntax for
>> that function call.
>>
>
> I've finally managed to get gram.y to parse the syntax correctly. After
> progressing from a segmentation fault that occured when the grammar was
> correct I'm now left with a cryptic error:
>
> xmltest=# SELECT COUNT(id) FROM xmltest WHERE xmlexists('/menu/beers'
> PASSING BY REF data);
> ERROR:  unrecognized node type: 1852140847
>
> At a guess there is another step that I need to do after modifying gram.y.
> One mailing list posting I found mentioned copyfuncs.c but really I'm unsure
> as to what next. Anyone know what the missing step is?

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
memory clobber.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2010-06-22 18:02:02 Re: TCP keepalive support for libpq
Previous Message Robert Haas 2010-06-22 17:32:26 Re: TCP keepalive support for libpq