DISCARD
Clears part of the state associated with the current session. It does not undo
a transaction; use ROLLBACK for that.
Supported forms
DISCARD SEQUENCES;
DISCARD ALL;
DISCARD SEQUENCES discards the local state kept for nextval/currval.
The next use registers the sequences visible to the session again. It does
not change a sequence’s persisted value.
DISCARD ALL does the same and also removes values set with SET, restoring
GUCs to their defaults, including
default_transaction_isolation = 'read committed'.
In this version, DISCARD can only run while the session is idle, outside a
BEGIN/COMMIT block. Otherwise it returns SQLSTATE 25001.
Limitations
DISCARD PLANS is not supported yet because protocol prepared statements and
portals are kept by the server loop, outside the Session object. DISCARD TEMPORARY is also not supported because temporary tables are not part of the
current language subset.
These forms are recognized by the parser but return SQLSTATE 0A000.