issue #21448: improve error reporting for legacy postgres functions