Re: Adding XMLEXISTS to the grammar - Mailing list pgsql-hackers

From Mike Fowler
Subject Re: Adding XMLEXISTS to the grammar
Date
Msg-id 4C23A5D1.30107@mlfowler.com
Whole thread Raw
In response to Re: Adding XMLEXISTS to the grammar  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Adding XMLEXISTS to the grammar
List pgsql-hackers
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
> memory clobber.

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 following:

xmltest=# SELECT COUNT(id) FROM xmltest WHERE xmlexists('/menu/beers' 
PASSING BY REF data);
ERROR:  function pg_catalog.xml_exists(text, xml) does not exist
LINE 1: SELECT COUNT(id) FROM xmltest WHERE xmlexists('/menu/beers' ...                                           ^
HINT:  No function matches the given name and argument types. You might 
need to add explicit type casts.

In gram.y I've got:

FuncCall *n = makeNode(FuncCall);
n->funcname = SystemFuncName("xml_exists");

(also tried SystemFuncName("xmlexists");)

In xml.h:

extern bool xml_exists(text *xpath_expr_text, xmltype *data);

I've also tried

bool xml_exists(PG_FUNCTION_ARGS) {

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");

(also tried ( xml_exists   PGNSP....))

After each attempt, I've blown away the installation, made clean and 
installed, initialised a fresh database and restored my sample database. 
I've had a grep around using position and it's target function textpos 
as examples but I fail to see any other file that they live in other 
than their implementation. As far as I can tell, I'm not doing anything 
different from position. Any thoughts?

Regards,

-- 
Mike Fowler
Registered Linux user: 379787



pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: EOL for 7.4 and 8.0
Next
From: Josh Berkus
Date:
Subject: Re: EOL for 7.4 and 8.0