Dear Madam or Sir,
Looks like I've found a bug in PostgreSQL, bug report is in attachment.
-- Sincerely yours,Yury