Postgres: random inexplicable OOM

Rroot4/23/2023
Project ID: N/A
(any of them)
When trying to run the query SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' on any database, it gives an out-of-memory error. When I add a semicolon, my app segfaults.
A snippet of my code:
public Gtk.Widget overview_page() {
    var box = new FlowBox();
    box.append(info_card("Properties",
                                URL: connection.url));
    GLib.print("hi\n");
    var tables_box = new Box(VERTICAL, 2);
    GLib.print("hi\n");
    var tables = db.exec("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'");
    GLib.print("hi\n");
    var status = tables.get_status();
    GLib.print(db.get_error_message());
    foreach_result(tables, (i, j, v) => {
        if(j == 0) {
            tables_box.append(new Label(v));
        }
    });
    
    box.append(titled_section("Tables", VERTICAL, tables_box));
    return box;
}

(ignore the debugging™️)