"Sergiy Vyshnevetskiy" <serg@vostok.net> writes:
> Possible reason is forgotten SPI_push()/SPI_pop() wrapper in domain check
> evaluation algorithm.
I think it's really plpgsql's fault, not the domain code. Try this patch:
http://archives.postgresql.org/pgsql-committers/2007-01/msg00405.php
There might be similar problems elsewhere ...
regards, tom lane