Rafael Martinez <r.m.guerrero@xxxxxxxxxxx> writes: > We have a function in C which is accessed via a view and which produces > a strange result when used together with || (String concatenation). > I can not find the problem. Any C/postgres guru with any idea of how to > fix it? You need to set the size of the text result correctly. As is, you're returning a 252-byte result containing embedded nulls and random garbage. Embedded nulls, in particular, are verboten. The fixed-size palloc is okay (as long as you're sure it's enough), but the length word should only count valid data. regards, tom lane