Re: problem with splitting a string - Mailing list pgsql-hackers

From Tom Lane
Subject Re: problem with splitting a string
Date
Msg-id 10104.1249482661@sss.pgh.pa.us
Whole thread Raw
In response to problem with splitting a string  (Werner Echezuria <wercool@gmail.com>)
Responses Re: problem with splitting a string
List pgsql-hackers
Werner Echezuria <wercool@gmail.com> writes:
> I'm trying to develop a contrib module in order to parse sqlf queries, I'm
> using lemon as a LALR parser generator (because I think it's easier than
> bison) and re2c (because I think it's easier than flex) but when I try to
> split the string into words postgres add some weird characters (this works
> in pure gcc), I write something like "CREATE FUZZY PREDICATE joven ON 0..120
> AS (0,0,35,120);", but postgresql adds a character like  at the end of
> "joven" and the others words.

Maybe you are expecting 'text' values to be null-terminated?  They are
not.  You might look into using TextDatumGetCString or related functions
to convert.
        regards, tom lane

PS: the chances of us accepting a contrib module that requires
significant unusual infrastructure to build seem pretty low from
where I sit.  You're certainly free to do whatever you want for
private work, or even for a pgfoundry project --- but if you do
have ambitions of this eventually becoming contrib, "it's easier"
is not going to be sufficient rationale to not use bison/flex.


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: the case for machine-readable error fields
Next
From: "David E. Wheeler"
Date:
Subject: Re: md.c should not call files "relations"