def METHOD_NAME(pgconn):
    res = pgconn.exec_(
        b"""
        begin;
        declare cur cursor for select * from generate_series(1,10) foo;
        """
    )
    assert res.status == pq.ExecStatus.COMMAND_OK, res.error_message
    res = pgconn.close_portal(b"cur")
    assert res.status == pq.ExecStatus.COMMAND_OK, res.error_message
    # Because we closed it, describing should not work
    res = pgconn.describe_portal(b"cur")
    assert res.status == pq.ExecStatus.FATAL_ERROR