• Tom Lane's avatar
    Fix assorted small bugs in ThrowErrorData(). · 8529036b
    Tom Lane authored
    Copy the palloc'd strings into the correct context, ie ErrorContext
    not wherever the source ErrorData is.  This would be a large bug,
    except that it appears that all catchers of thrown errors do either
    EmitErrorReport or CopyErrorData before doing anything that would
    cause transient memory contexts to be cleaned up.  Still, it's wrong
    and it will bite somebody someday.
    
    Fix failure to copy cursorpos and internalpos.
    
    Utter the appropriate incantations involving recursion_depth, so that
    we'll behave sanely if we get an error inside pstrdup.  (In general,
    the body of this function ought to act like, eg, errdetail().)
    
    Per code reading induced by Jakob Egger's report.
    8529036b
elog.c 99.3 KB