jian he <jian.universal...@gmail.com> writes: > just found out the"elog(INFO, "should not reached here");" part never reached.
You didn't check any of the cases we were discussing I guess? (That is, places in gram.y that throw an error without a parser_errposition call.) Note that even if we fix all of those and keep them fixed, we still couldn't assume the case is unreachable, because gram.y isn't self-contained. For instance, if we hit out-of-memory during raw parsing, the OOM error out of mcxt.c isn't going to provide a syntax error position. I'm not too concerned about doing better than what the patch does now (i.e. nothing) in such edge cases, but we can't do worse. > i guess, we don't need performance in script_error_callback, > but in script_error_callback arrange code seperate syntax error(raw > parser) and other error seems good. > please check the attached minor refactor. I do not think that's an improvement. It's more complicated and less readable, and I don't see why we need to squeeze more performance out of this error-reporting path that should never be taken in production. regards, tom lane