diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c index 227e01c6191612c3fb3eeccb361c1589624cd086..d0a982a4a3aa2f3ba58b198500f18d693099e744 100644 --- a/src/backend/executor/execTuples.c +++ b/src/backend/executor/execTuples.c @@ -1282,33 +1282,32 @@ do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull) * Should only be used with a single-TEXT-attribute tupdesc. */ void -do_text_output_multiline(TupOutputState *tstate, char *text) +do_text_output_multiline(TupOutputState *tstate, const char *txt) { Datum values[1]; bool isnull[1] = {false}; - while (*text) + while (*txt) { - char *eol; + const char *eol; int len; - eol = strchr(text, '\n'); + eol = strchr(txt, '\n'); if (eol) { - len = eol - text; - + len = eol - txt; eol++; } else { - len = strlen(text); - eol += len; + len = strlen(txt); + eol = txt + len; } - values[0] = PointerGetDatum(cstring_to_text_with_len(text, len)); + values[0] = PointerGetDatum(cstring_to_text_with_len(txt, len)); do_tup_output(tstate, values, isnull); pfree(DatumGetPointer(values[0])); - text = eol; + txt = eol; } } diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index f60d809bc987ccdc87e91ba06a5acc0e224b11d6..ba3cfc8d73896954424f29ac44c0465fa2be25b6 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -275,7 +275,7 @@ typedef struct TupOutputState extern TupOutputState *begin_tup_output_tupdesc(DestReceiver *dest, TupleDesc tupdesc); extern void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull); -extern void do_text_output_multiline(TupOutputState *tstate, char *text); +extern void do_text_output_multiline(TupOutputState *tstate, const char *txt); extern void end_tup_output(TupOutputState *tstate); /*