Work with breakpoints

A breakpoint tells the debugger that execution should break, or pause, at a certain point. When a break occurs, you can use the debugger windows to evaluate the variables of the routine. A breakpoint stops the code on the statement that would be executed next.

When the debugger breaks execution, the routine stays paused until you use the Continue, Step Into, Step Over, or Step Out command to continue execution. For more information, see Control execution while debugging.

Note

Conditional breakpoints and hit-count breakpoints aren’t supported.

Where you can set a breakpoint

You can set a breakpoint only on an executable PL/pgSQL statement inside the body of a routine, that is, between BEGIN and END.

You can’t set a working breakpoint on:

  • The DECLARE section of a block.
  • Comments and blank lines.
  • The CREATE FUNCTION / CREATE PROCEDURE header and the closing dollar quote.

If you try to set a breakpoint on such a line, no breakpoint icon appears.

A breakpoint set in a routine that hasn’t been compiled for debugging never fires. This also applies to routines that are called from the one you’re debugging: to break inside a called routine, compile it for debugging too.

A breakpoint set while a routine is running doesn’t take effect immediately. It becomes active the next time the debugger enters break mode.

Breakpoint status

Icons in the gray margin of the editor indicate the status of a breakpoint.

Icon Status Description
Solid red circle icon Enabled Execution will be interrupted at this breakpoint.
Red circle icon with a white center Disabled The debugger ignores this breakpoint.
Orange circle icon with an exclamation mark Warning The debugger can’t bind the breakpoint to this line because either the line isn’t executable, or the debug engine hasn’t finished deploying yet.

For more icons, see Icon reference.

Insert breakpoints

You can set a breakpoint in the following ways:

  • Right-click the executable statement in the editor where you want to set the breakpoint and select Insert Breakpoint.
  • Click the executable statement in the editor, then, on the menu bar, select Debug > Toggle Breakpoint.
  • Click the gray margin of the editor next to the statement.
  • Click the statement, then press F9.

The breakpoint icon appears in the editor margin.

Delete breakpoints

You can delete a breakpoint in the following ways:

  • Right-click the line with the breakpoint and select Delete Breakpoint.
  • Click the line with the breakpoint, then, on the menu bar, select Debug > Toggle Breakpoint.
  • Click the breakpoint in the editor margin.
  • Select the breakpoint in the Breakpoints window, then click Delete on the Breakpoints window toolbar.
  • Right-click the breakpoint in the Breakpoints window and select Delete.
  • Click the line with the breakpoint, then press F9.

To delete every breakpoint at once, use one of these ways:

  • On the menu bar, select Debug > Delete All Breakpoints.
  • On the Breakpoints window toolbar, click Delete All Breakpoints.
  • Press Ctrl+Shift+F9.

Turn on or turn off a breakpoint

To turn off a breakpoint without deleting it, clear the checkbox next to it in the Breakpoints window. Select the checkbox to turn it on again.

Click Disable/Enable All Breakpoints to toggle all breakpoints at once. This action turns on all breakpoints if at least one of them is turned off, and turns off all breakpoints if all of them are turned on.

Icon reference

The table describes the icons used in the debugger.

Icon Description Triggering event
Solid red circle icon A breakpoint is active.
Execution pauses when this line is reached.
Appears when you insert a breakpoint.
Red circle icon with a white center A breakpoint exists but is inactive, and the debugger ignores it during execution. Appears when you turn off a breakpoint.
Orange circle icon with an exclamation mark The breakpoint is in a warning state, indicating it can’t be executed. Appears when you try to set a breakpoint on a line that can’t be executed, or before the debug engine has finished deploying.
Yellow arrow pointing right Indicates the line of code currently being executed or shows the call stack location in the Call Stack window. Appears when execution is paused and helps you identify where the debugger is currently positioned.
Red circle icon with a white arrow pointing right Execution stops at the breakpoint. Appears when the debugger has paused on the line where the breakpoint is set.
Red circle icon with a white center and a red arrow pointing right Execution passed through an inactive breakpoint without pausing. Appears when execution reaches a line that contains an inactive breakpoint; the debugger marks the line but doesn’t pause there.
Yellow arrow pointing right with a small red circle Steps into the function that’s called from the code currently being debugged. Appears when the debugger is paused and marks the exact line of code that will run next when execution continues. It also appears when you step through code.