"James Moss" <jpmoss@gmail.com> writes:
> I could use a helpful suggestion or two as to why the following is
> occuring or more to the matter, how I might work around it. Certainly
> appears to be a bug or some sort of misunderstanding on my part.
The content of a text datum is not guaranteed null-terminated, hence
you can't just take VARDATA(a) as being a C string. The cleanest way
to convert to C string if you need to is to call textout() --- look
around in the sources for examples to copy.
regards, tom lane