Tim
Tim

Reputation: 8919

With pgAdmin debugger is it possible to examine the contents of temporary tables used in the function?

When stepping through a function in the pgAdmin debugger, how to examine the contents of temporary tables, if that is possible?

Upvotes: 2

Views: 602

Answers (1)

Chris Travers
Chris Travers

Reputation: 26464

Probably the best thing to do would be to add conditional logic based on variables you could set in the debugger. Then you could set the variables to useful states and run that way. For example:

CREATE OR REPLACE FUNCTION test_function() RETURNS BOOL LANGUAGE PLPGSQL AS
$$
DECLARE t_debug int;
        t_record RECORD;
BEGIN;
IF t_debug > 1 THEN
   FOR t_record IN SELECT * FROM my_temp_table LOOP
      RAISE NOTICE 'Row in my_temp_table: %', t_record::text;
   END LOOP;
END IF;
RETURN TRUE;
$$;

Upvotes: 2

Related Questions