Seaquel
PostgreSQL error code

PostgreSQL error 42P03

42P03 is the SQLSTATE PostgreSQL reports for duplicate cursor, in class 42, Syntax Error or Access Rule Violation.

SQLSTATE42P03
Condition nameduplicate_cursor
Class42 — Syntax Error or Access Rule Violation

Reproduce it, then fix it

A cursor with that name is already open in this transaction. Close it before declaring it again, or give the second one another name. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.

DECLARE c CURSOR FOR SELECT name FROM products;
DECLARE c CURSOR FOR SELECT email FROM customers;
DECLARE c CURSOR FOR SELECT name FROM products;
CLOSE c;
DECLARE c CURSOR FOR SELECT email FROM customers;
FETCH 3 FROM c;

Source: PostgreSQL documentation, Appendix A