Re: Adding XMLEXISTS to the grammar

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: Re: Adding XMLEXISTS to the grammar
Date: 2010-06-24 18:37:05
Message-ID: 4C23A5D1.30107@mlfowler.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2010-06-24 18:42:29 Re: EOL for 7.4 and 8.0
Previous Message Joshua D. Drake 2010-06-24 18:03:13 Re: EOL for 7.4 and 8.0