Jessica Ditt <jessica(dot)ditt(at)web(dot)de> writes:
> I don't know, where I made a mistake. I haven't been thinking of
> toasting / detoasting yet, although I now think, I have to.
If you are going to mark the datatype as toastable then you have to
be prepared to detoast values received by your functions.
Usually it's possible to hide this in your GETARG macro for the type.
regards, tom lane