Welcome to psql 8.1devel, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit postgres=# set trace_plpgsql to on; SET postgres=# select fa(10); trace: executing function fa trace: for with integer loopvar on 3: FOR k IN 1..i LOOP dbg. s trace: raise on 4: RAISE NOTICE '%', k; dbg. p var-. k trace: var k as int4 has 1 dbg. l trace: source of function fa 1: DECLARE x integer = 1; 2: BEGIN 3: FOR k IN 1..i LOOP 4: RAISE NOTICE '%', k; 5: x := x + 1; 6: END LOOP; 7: RETURN x; 8: END; 9: dbg. s NOTICE: 1 trace: assignment on 5: x := x + 1; dbg. b trace: Breakpoint set on dbg. c trace: raise on 4: RAISE NOTICE '%', k; NOTICE: 2 trace: assignment on 5: x := x + 1; trace: stop on breakpoint dbg. c trace: raise on 4: RAISE NOTICE '%', k; NOTICE: 3 trace: assignment on 5: x := x + 1; trace: stop on breakpoint dbg. p var-. * trace: var k as int4 has 3 trace: var x as int4 has 3 trace: var found as bool has f trace: var $1 as int4 has 10 dbg. c trace: raise on 4: RAISE NOTICE '%', k; NOTICE: 4 trace: assignment on 5: x := x + 1; trace: stop on breakpoint dbg. b trace: Breakpoint set off dbg. c trace: raise on 4: RAISE NOTICE '%', k; NOTICE: 5 trace: assignment on 5: x := x + 1; trace: raise on 4: RAISE NOTICE '%', k; NOTICE: 6 trace: assignment on 5: x := x + 1; trace: raise on 4: RAISE NOTICE '%', k; NOTICE: 7 trace: assignment on 5: x := x + 1; trace: raise on 4: RAISE NOTICE '%', k; NOTICE: 8 trace: assignment on 5: x := x + 1; trace: raise on 4: RAISE NOTICE '%', k; NOTICE: 9 trace: assignment on 5: x := x + 1; trace: raise on 4: RAISE NOTICE '%', k; NOTICE: 10 trace: assignment on 5: x := x + 1; trace: return on 7: RETURN x; fa ---- 11 (1 row) postgres=# \q Process SQL finished