Hello 2012/3/5 Alvaro Herrera <alvhe...@commandprompt.com>: > > Excerpts from Pavel Stehule's message of dom mar 04 16:33:08 -0300 2012: >> >> Hello >> >> 2012/3/4 Alvaro Herrera <alvhe...@commandprompt.com>: > >> > CHECK FUNCTION >> > --------------------------------------------------------- >> > In function: 'f()' >> > error:42P01:2:sentencia SQL:no existe la relación «foo» >> > query:select + >> > var + >> > from + >> > foo >> > ^ >> > (4 filas) >> > >> >> this should be fixed. I checked expressions, that works (I expect) >> correctly. Caret helps - (really). Sometimes man is blind :). > > Agreed. >
I don't have your last version, so I am sending just part of CheckFunctionById function - this fragment ensures a output or please, send me your last patch and I'll do merge now result is better postgres=> create function f() returns int language plpgsql as $$ postgres$> begin select postgres$> var postgres$> from postgres$> foo; end; $$; CREATE FUNCTION postgres=> check function f(); CHECK FUNCTION ----------------------------------------------------------- In function: f() error:42P01:2:SQL statement:relation "foo" does not exist query:select var from foo ^ (7 rows) and some utf8 fce postgres=> check function fx(int); CHECK FUNCTION -------------------------------------------------- In function: fx(integer) error:42703:3:RETURN:column "ýšý" does not exist query:SELECT (select žlutý from jj /* ýšý */ where /*ýšýšý8*/ ýšý = 10) ^ (7 rows) postgres=> check function fx(int); CHECK FUNCTION ------------------------------------------------- In function: fx(integer) error:42703:3:RETURN:column "xx" does not exist query:SELECT (select t.a from t /* ýšý */ where /*ýšýšý8*/ xx = 10) ^ (7 rows) caret is ok regards Pavel > -- > Álvaro Herrera <alvhe...@commandprompt.com> > The PostgreSQL Company - Command Prompt, Inc. > PostgreSQL Replication, Consulting, Custom Development, 24x7 support
else { resetStringInfo(&sinfo); appendStringInfo(&sinfo, "In function: %s", funcname); do_text_output_oneline(tstate, sinfo.data); for (i = 0; i < SPI_processed; i++) { char *query; resetStringInfo(&sinfo); appendStringInfo(&sinfo, "%s:%s:%s:%s:%s", SPI_getvalue(SPI_tuptable->vals[i], SPI_tuptable->tupdesc, 8), SPI_getvalue(SPI_tuptable->vals[i], SPI_tuptable->tupdesc, 4), SPI_getvalue(SPI_tuptable->vals[i], SPI_tuptable->tupdesc, 2), SPI_getvalue(SPI_tuptable->vals[i], SPI_tuptable->tupdesc, 3), SPI_getvalue(SPI_tuptable->vals[i], SPI_tuptable->tupdesc, 5)); do_text_output_oneline(tstate, sinfo.data); resetStringInfo(&sinfo); query = SPI_getvalue(SPI_tuptable->vals[i], SPI_tuptable->tupdesc, 10); if (query != NULL) { bool isnull; char *query_line; /* pointer to begin of processed line */ int query_line_caret; int caret; bool is_first_line = true; /* * put any query line to separate output line. And append * a curet, when is defined and related to processed rows. */ caret = SPI_getbinval(SPI_tuptable->vals[i], SPI_tuptable->tupdesc, 9, &isnull); if (isnull) caret = -1; query_line = query; query_line_caret = caret; while (*query != '\0') { int len; if (*query == '\n') { /* now we found end of line */ *query = '\0'; if (is_first_line) { appendStringInfo(&sinfo, "query:%s", query_line); is_first_line = false; } else appendStringInfo(&sinfo, " %s", query_line); do_text_output_oneline(tstate, sinfo.data); resetStringInfo(&sinfo); if (query_line_caret > 0 && caret == 0) { appendStringInfo(&sinfo, " %*s", query_line_caret, "^"); do_text_output_oneline(tstate, sinfo.data); resetStringInfo(&sinfo); query_line_caret = 0; } /* store caret offset for next line */ if (caret > 0) query_line_caret = caret - 1; /* go to next line */ query_line = query + 1; } len = pg_mblen(query); query += len; if (caret > 0) caret--; } /* last line output */ if (query_line != NULL) { if (is_first_line) { appendStringInfo(&sinfo, "query:%s", query_line); } else appendStringInfo(&sinfo, " %s", query_line); do_text_output_oneline(tstate, sinfo.data); resetStringInfo(&sinfo); if (query_line_caret > 0 && caret == 0) { appendStringInfo(&sinfo, " %*s", query_line_caret, "^"); do_text_output_oneline(tstate, sinfo.data); resetStringInfo(&sinfo); } } } } }
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers