# Dune Schema Routines — Reference & Cross-Map

Complete export of every function and procedure in the `dune` schema of the game-server Postgres (PG 17.4, pod `sh-ec68e59f636959ac-coyzzx-db-dbdepl-sts-0`). Generated by `_export.sh` + `_build_readme.py`.

## Inventory

- **Total routines:** 523
- **Functions:** 517
- **Procedures:** 6
- **Called from dune-admin Go source:** 18 (see Cross-reference column)
- **Not called from dune-admin:** 505

Per-routine SQL lives in `functions/<category>/<name>__<argcount>args.sql` and `procedures/<name>__<argcount>args.sql`. A single concatenated dump is at `_all.sql`. A TSV index is at `_manifest.tsv`.

## Access path (read-only)

```
ssh -i ./sshKey dune@192.168.0.72 \
  "sudo -n kubectl exec -n funcom-seabass-sh-ec68e59f636959ac-coyzzx \
     sh-ec68e59f636959ac-coyzzx-db-dbdepl-sts-0 -- \
     env PGPASSWORD=<pw> psql -h 127.0.0.1 -p 15432 -U postgres -d dune <args>"
```

Passwordless `sudo` works on the VM. The password is also visible inside the pod via `env | grep POSTGRES_PASSWORD`.

## Categories

| Category | Count |
|---|---:|
| [actors](#actors) | 23 |
| [anticheat](#anticheat) | 3 |
| [base_backup](#base-backup) | 14 |
| [battlegroup](#battlegroup) | 2 |
| [building_blueprint](#building-blueprint) | 16 |
| [character_mod](#character-mod) | 16 |
| [cleanup](#cleanup) | 4 |
| [communinet](#communinet) | 4 |
| [currency](#currency) | 8 |
| [debug](#debug) | 10 |
| [dialogue](#dialogue) | 3 |
| [dungeon](#dungeon) | 4 |
| [encryption](#encryption) | 9 |
| [event_log](#event-log) | 5 |
| [exchange](#exchange) | 20 |
| [faction](#faction) | 9 |
| [farm](#farm) | 4 |
| [guild](#guild) | 19 |
| [igwo](#igwo) | 1 |
| [inventory](#inventory) | 21 |
| [items_purge](#items-purge) | 7 |
| [journey_progression](#journey-progression) | 28 |
| [landclaim](#landclaim) | 2 |
| [landsraad](#landsraad) | 39 |
| [lookup](#lookup) | 49 |
| [map_areas](#map-areas) | 12 |
| [markers](#markers) | 8 |
| [misc](#misc) | 23 |
| [partition](#partition) | 28 |
| [party](#party) | 13 |
| [permission](#permission) | 13 |
| [player_persistence](#player-persistence) | 9 |
| [schema_meta](#schema-meta) | 6 |
| [server](#server) | 9 |
| [shifting_sand](#shifting-sand) | 3 |
| [spawner](#spawner) | 4 |
| [spice_field](#spice-field) | 12 |
| [stock_vendor](#stock-vendor) | 5 |
| [takeover](#takeover) | 3 |
| [taxation](#taxation) | 8 |
| [transfer](#transfer) | 29 |
| [travel](#travel) | 3 |
| [vehicle](#vehicle) | 15 |

### actors

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `assign_actor_id` | in_class text → bigint | — | Assign actor id. |
| `delete_actor_states_travel` | in_actor_id bigint → void | — | Delete actor states travel. |
| `delete_actors` | in_ids bigint[] → void | — | Delete actors. |
| `delete_actors_and_respawns_on_server` | in_server_info dune.serverinfo, in_vehicle_classes_spawned_on_map text[], in_allow_vehicle_recovery boolean → void | — | Delete actors and respawns on server. |
| `delete_markers_return_actor_ids` | in_dimension_index integer, in_map_name text, in_marker_ids integer[] → TABLE(actor_id bigint, marker_id integer) | — | Delete markers return actor ids. |
| `find_actor_by_id` | in_id bigint → dune.actorspawninfo | — | Find actor by id. |
| `gather_ownerless_actors_on_server` | in_server_info dune.serverinfo → SETOF dune.actorspawninfo | — | Gather ownerless actors on server. |
| `gather_player_linked_actors` | in_player_pawn_id bigint → SETOF dune.actorspawninfo | — | Gather player linked actors. |
| `gather_removed_accounts_that_left_orphaned_actors_on_server` | in_server_info dune.serverinfo → TABLE(account_id bigint, removal_reason text, actors_left dune.orphanedplayeractorinfo[]) | — | Gather removed accounts that left orphaned actors on server. |
| `get_account_actor_ids` | in_account_id bigint → dune.playeractorids | — | Get account actor ids. |
| `get_actor_server_info` | in_id bigint → dune.serverinfo | — | Get actor server info. |
| `get_registered_spawned_actor` | in_spawner_id bigint → SETOF bigint | — | Get registered spawned actor. |
| `load_actors` | in_actor_ids bigint[], in_actor_state dune.actorstate → TABLE(ord bigint, actor_id bigint, generic_data dune.actorgenericdata, serial bigint) | — | Load actors. |
| `load_full_actors` | in_ids bigint[] → SETOF dune.actordescription | — | Load full actors. |
| `ownership_handle_actor_delete` | in_player_id bigint → void | — | Ownership handle actor delete. |
| `register_spawned_actor` | in_spawner_id bigint, in_actor_id bigint → void | — | Register spawned actor. |
| `remove_aborted_authority_transfer_actors` | in_partition_id bigint → SETOF dune.actorspawninfo | — | Remove aborted authority transfer actors. |
| `remove_recipes_from_actor_properties` | recipes_to_remove text[] → void | — | Remove recipes from actor properties. |
| `save_aborted_authority_transfer_actors` | in_actor_ids bigint[], in_partition_id bigint → void | — | Save aborted authority transfer actors. |
| `save_actor_dislocation` | in_actor_id bigint, in_current_server_info dune.serverinfo, in_target_location dune.vector, in_target_dimension_index integer → void | — | Save actor dislocation. |
| `save_actors` | in_server_info dune.serverinfo, in_actors dune.actordescription[], in_actor_state dune.actorstate → TABLE(actor_id bigint, current_saved_serial bigint, saved boolean) | — | Save actors. |
| `update_traveling_actor_dependencies` | in_dep dune.traveldependency[] → void | — | Update traveling actor dependencies. |
| `update_traveling_actor_tree` | in_actor_id bigint, in_target_transform dune.transform, in_target_map text, in_target_dimension_index integer, in_target_partition_id bigint → TABLE(out_id bigint, out_actor_state text) | — | Update traveling actor tree. |

### anticheat

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `add_actor_audit` | in_id bigint, in_class text → void | — | Add actor audit. |
| `flag_player_as_cheater` | in_account_id bigint, in_cheat_type dune.cheat_type_enum → void | — | Mark account as a cheater of given type. |
| `log_cheating` | in_fls_id text, in_cheat_type dune.cheat_type_enum, in_event_time timestamp with time zone → void | — | Append cheating event. |

### base_backup

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `base_backup_delete` | in_base_backup_id bigint → void | — | Delete a stored base backup. |
| `base_backup_find_totems_from_player_owner` | in_player_id bigint → TABLE(totem_id bigint) | — | List totem ids owned by a player (read-only). |
| `base_backup_finish_placing` | in_base_backup_id bigint → void | — | Finalize placement of a restored backup. |
| `base_backup_get_actors_to_spawn` | in_base_backup_id bigint → SETOF dune.actorspawninfo | — | Read actors to spawn for backup placement. |
| `base_backup_get_available_backups` | in_player_id bigint → TABLE(id bigint, base_backup_name text, totem_id bigint, totem_buildable_type text, landclaim_original_global_location real[], base_backup_map text) | — | List stored backups for a player. |
| `base_backup_get_buildable_data` | in_base_backup_id bigint → TABLE(buildable_type text, total_count integer) | — | Read buildable-piece data for a backup. |
| `base_backup_get_data` | in_base_backup_id bigint → dune.getbasebackupdata | — | Read backup metadata. |
| `base_backup_get_totem_data` | in_base_backup_id bigint → dune.basebackuptotemdata | — | Base backup get totem data. |
| `base_backup_get_totem_data_from_totem_id` | in_totem_id bigint → dune.basebackuptotemdata | — | Base backup get totem data from totem id. |
| `base_backup_get_totem_id` | backup_id bigint → bigint | — | Base backup get totem id. |
| `base_backup_recycle` | in_base_backup_id bigint, in_target_inventory_id bigint → integer | — | Recycle a stored base backup into an inventory. |
| `base_backup_save` | in_player_actor_id bigint, in_base_backup_name text, in_building_pieces_to_link dune.basebackupbuildingitem[], in_placeables_to_link bigint[], in_placeables_to_remove_totem_owner bigint[] → bigint | — | Base backup save. |
| `base_backup_save_all_totems_from_player_owner` | in_player_id bigint → TABLE(base_backup_id bigint) | — | Snapshot every base a player owns; returns set of backup ids. |
| `base_backup_save_from_totem` | in_player_id bigint, totem_id bigint → bigint | — | Snapshot a single base keyed by totem id; returns backup id. |

### battlegroup

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `get_battlegroup_close_date` | () → timestamp without time zone | — | Get battlegroup close date. |
| `set_battlegroup_close_date` | in_close_date timestamp without time zone → timestamp without time zone | — | Set battlegroup close date. |

### building_blueprint

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `_building_validate_totem_owner_id` | in_totem_owner_id bigint → bigint | — | Building validate totem owner id. |
| `_placeable_validate_totem_owner_id` | in_totem_owner_id bigint → bigint | — | Placeable validate totem owner id. |
| `delete_building_blueprint` | in_building_item_id bigint → void | — | Delete building blueprint. |
| `get_building_blueprint_copy_data` | in_building_blueprint_id bigint → dune.buildingblueprintgetcopydata | — | Get building blueprint copy data. |
| `get_building_favorites` | in_account_id bigint → TABLE(building_types text[]) | — | Get building favorites. |
| `get_building_id` | in_actor_id bigint, in_class text → dune.buildinggetidcomposite | — | Get building id. |
| `get_placeable_id` | in_actor_id bigint, in_class text, in_building_type text → dune.placeablegetidcomposite | — | Get placeable id. |
| `load_building` | in_building_id bigint → dune.buildingsavedata | — | Load building. |
| `load_placeable` | in_placeable_id bigint → dune.placeablesavedata | — | Load placeable. |
| `load_totem` | in_id bigint → dune.totemsavedata | — | Load totem. |
| `save_building` | in_building_id bigint, in_data dune.buildingsavedata → void | — | Save building. |
| `save_building_blueprint_copy` | in_building_item_id bigint, in_building_blueprint_id bigint, in_building_blueprint_building_data dune.buildingblueprintpiecesaveitemcontainer[], in_building_blueprint_placeable_data dune.buildingblueprintplaceablesaveitemcontainer[], in_building_blueprint_pentashield_data dune.buildingblueprintpentashielditem[] → bigint | — | Save building blueprint copy. |
| `save_placeable` | in_placeable_id bigint, in_data dune.placeablesavedata → void | — | Save placeable. |
| `save_totem` | in_id bigint, in_data dune.totemsavedata → void | — | Save totem. |
| `update_server_building_favorites` | in_account_id bigint, in_building_types text[] → void | — | Update server building favorites. |
| `update_server_learned_building_sets` | in_account_id bigint, in_learned_building_sets text[] → void | — | Update server learned building sets. |

### character_mod

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `delete_character` | in_actor_id bigint → void | — | Delete character. |
| `initialize_specialization_keystones` | in_keystones text[] → TABLE(keystone_id smallint, keystone_name text) | — | Initialize specialization keystones. |
| `login_account` | in_user_id text, in_funcom_id text, in_platform_id text, in_platform_name text, in_minimum_returning_player_time_seconds integer, in_character_name text, in_return_dimension_index integer, in_home_dimension_index integer → SETOF dune.playerdescription | — | Full login flow; returns player description (called by game server). |
| `permission_set_player_rank` | in_actor_id bigint, in_player_id bigint, in_rank smallint, in_map_id text → void | — | Permission set player rank. |
| `player_state_update` | in_data dune.playerstateupdatedata[] → void | — | Player state update. |
| `purchase_specialization_keystone` | in_player_id bigint, in_keystone text → boolean | — | Validate-then-record a keystone purchase. Returns bool. |
| `reset_specialization_keystones` | in_player_id bigint → void | `db.go:740` | Wipe all purchased keystones for a player. |
| `reset_specialization_tracks` | in_player_id bigint → void | `db.go:737` | Wipe all specialization tracks for a player. |
| `returning_player_award_given` | in_account_id bigint → void | — | Stamp last_returning_player_awarded_time = now() for an account. |
| `set_character_import_state` | in_fls_id text, in_state dune.transferimportstate → void | — | Set character import state. |
| `set_character_name` | in_account_id bigint, in_name text → void | `db.go:577` | Rename a character. |
| `set_players_from_server_ids_offline` | in_server_ids text[] → void | — | Set players from server ids offline. |
| `set_specialization_xp_and_level` | in_player_id bigint, in_track_type dune.specializationtracktype, in_xp_amount integer, in_level real → void | `db.go:2936` | Directly set spec XP and level for a player on a given track. |
| `update_player_tags` | in_account_id bigint, tags_to_add text[], tags_to_remove text[] → void | `db.go:628`<br>`db.go:1458`<br>`db.go:1938`<br>`db.go:1966`<br>`db.go:2245` | Add and/or remove gameplay tags for an account in one call. |
| `update_returning_player_status` | in_user_id text, in_minimum_returning_player_time_seconds integer → void | `db.go:665` | Recalculate returning-player eligibility on login. |
| `update_specialization_refund_id` | in_player_id bigint, in_refund_id smallint, in_removed_keystones smallint[] → void | — | Update specialization refund id. |

### cleanup

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `cleanup_orphaned_entities` | () → trigger | — | Cleanup orphaned entities. |
| `reset_all_players_from_server_ids_grace_period_and_logoff_timer` | in_server_id text, in_reset_time timestamp without time zone → void | — | Reset all players from server ids grace period and logoff timer. |
| `reset_server_all_player_access_codes` | in_account_id bigint → void | — | Reset server all player access codes. |
| `wipe_old_events_log` | in_days_limit integer → void | — | Wipe old events log. |

### communinet

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `load_communinet_player_data` | in_account_id bigint → TABLE(is_active boolean, selected_channel_name text, channel_name text, is_tuned boolean) | — | Load communinet player data. |
| `remove_communinet_player_channel` | in_account_id bigint, in_channel_name text → void | — | Remove communinet player channel. |
| `update_communinet_player_channel` | in_account_id bigint, in_channel_name text, in_is_tuned boolean → void | — | Update communinet player channel. |
| `update_communinet_player_data` | in_account_id bigint, in_is_active boolean, in_selected_channel_name text → void | — | Update communinet player data. |

### currency

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `adjust_player_virtual_currency_balance` | in_controller_id bigint, in_currency_id smallint, in_delta bigint → bigint | `db.go:475`<br>`db.go:519` | Atomic delta on Solaris/Scrip balance; returns new balance. |
| `dune_exchange_modify_user_solari_balance` | in_controller_id bigint, in_solari_delta bigint → void | — | Dune exchange modify user solari balance. |
| `dune_exchange_retrieve_solari_balance` | in_owner_id bigint → bigint | — | Dune exchange retrieve solari balance. |
| `dune_exchange_retrieve_solaris_from_item` | in_controller_id bigint, in_order_id bigint → dune.duneexchangeretrievesolarisfromitemresult | — | Dune exchange retrieve solaris from item. |
| `edit_guild_description` | in_guild_id bigint, in_guild_desc text → void | — | Edit guild description. |
| `get_player_virtual_currency_balances` | in_controller_id bigint → TABLE(out_currency_id smallint, out_currency_balance bigint) | — | List wallet balances for a controller. |
| `get_solaris_id` | () → smallint | `db.go:477`<br>`db.go:487`<br>`db.go:927` | Currency id used for Solaris. |
| `log_event_solaris` | in_function_oid oid, in_message dune.logmessagetype, in_controller_id bigint, in_solaris_balance bigint, in_solaris_delta bigint → void | — | Log event solaris. |

### debug

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `debug_add_test_table_data` | in_entry text → void | — | Debug add test table data. |
| `debug_collect_test_table_data` | () → SETOF text | — | Debug collect test table data. |
| `debug_echo` | in_text text, in_notices text[] → text | — | Debug echo. |
| `debug_get_coriolis_seeds` | () → TABLE(farm_seed integer, map_names text[], map_seeds integer[], partitions_ids bigint[], partitions_map text[], partitions_seeds integer[]) | — | Debug get coriolis seeds. |
| `debug_raise_exception` | in_exception text, in_notices text[] → void | — | Debug raise exception. |
| `debug_raise_notices` | in_notices text[] → void | — | Debug raise notices. |
| `debug_reset_test_table` | () → void | — | Debug reset test table. |
| `debug_set_farm_seed` | in_new_coriolis_seed integer → void | — | Debug set farm seed. |
| `debug_set_map_seed` | in_map text, in_new_coriolis_seed integer → void | — | Debug set map seed. |
| `debug_set_partition_seed` | in_partition_id bigint, in_new_coriolis_seed integer → void | — | Debug set partition seed. |

### dialogue

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `delete_dialogue_data` | in_player_controller_id bigint → void | — | Delete dialogue data. |
| `load_dialogue_data` | in_player_controller_id bigint, OUT met_npcs text[], OUT taken_nodes integer[] → record | — | Load dialogue data. |
| `save_dialogue_data` | in_player_controller_id bigint, in_met_npcs text[], in_taken_nodes integer[] → void | — | Save dialogue data. |

### dungeon

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `delete_all_dungeon_completions` | in_dungeon_id text → void | — | Delete all dungeon completions. |
| `delete_all_dungeon_completions_by_player` | in_dungeon_id text, in_player_id bigint, in_keep_completion_for_other_players boolean → void | — | Delete all dungeon completions by player. |
| `delete_all_dungeon_completions_for_all_dungeons_by_player` | in_player_id bigint, in_keep_completion_for_other_players boolean → void | — | Delete all dungeon completions for all dungeons by player. |
| `record_dungeon_completion` | in_dungeon_id text, in_difficulty integer, in_duration_ms integer, players_ids bigint[] → void | — | Record dungeon completion. |

### encryption

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `_user_data_encryption_initially_encrypt_existing_data` | () → void | — | User data encryption initially encrypt existing data. |
| `_user_data_encryption_setup_enabled` | key_hash bytea → void | — | User data encryption setup enabled. |
| `_user_data_encryption_setup_tainted` | () → void | — | User data encryption setup tainted. |
| `decrypt_user_data` | in_encrypted_data bytea → text | — | Decrypt user data. |
| `encrypt_user_data` | in_data text → bytea | — | Encrypt user data. |
| `get_stored_user_data_encryption_key_hash` | () → bytea | — | Get stored user data encryption key hash. |
| `get_stored_user_data_encryption_status` | () → dune.userdataencryptionstatus | — | Get stored user data encryption status. |
| `get_stored_user_data_encryption_taint_xmax` | () → bigint | — | Get stored user data encryption taint xmax. |
| `setup_user_data_encryption` _(proc)_ | IN in_enable boolean → void | — | Setup user data encryption. |

### event_log

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `add_event_log_data` | in_game_event_owner bigint, in_universe_time bigint, in_map_name text, in_partition_id bigint, in_event_type integer, in_x_location double precision, in_y_location double precision, in_z_location double precision, in_is_player_facing boolean, in_custom_data text → void | — | Add event log data. |
| `add_event_log_data_batched` | in_data dune.eventlogbulkentrydata[] → void | — | Add event log data batched. |
| `create_event_log_partition` | () → trigger | — | Create event log partition. |
| `create_event_log_partition_table` _(proc)_ | IN table_name text, IN partition_id bigint → void | — | Create event log partition table. |
| `init_event_log` | in_partition_id bigint → void | — | Init event log. |

### exchange

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `dune_exchange_add_sell_order` | in_exchange_id bigint, in_access_point_id bigint, in_owner_id bigint, in_max_orders_per_player integer, in_expiration_time bigint, in_item_id bigint, in_count bigint, in_category_mask integer, in_category_depth smallint, in_durability_cur real, in_durability_max real, in_item_price bigint, in_wear_normalized_item_price bigint, in_quality_level bigint, in_solari_cost bigint → dune.duneexchangeaddsellorderresult | — | Dune exchange add sell order. |
| `dune_exchange_cancel_order` | in_order_id bigint, in_purge_time bigint, in_completion_type integer → void | — | Dune exchange cancel order. |
| `dune_exchange_expire_orders` | in_exchange_id bigint, in_current_time bigint, in_purge_time bigint, in_expired_completion_type integer → SETOF dune.exchangeexpiredorder | — | Dune exchange expire orders. |
| `dune_exchange_fulfill_sell_order` | in_exchange_id bigint, in_max_orders_per_player integer, in_purchased_completion_type integer, in_sold_completion_type integer, in_instigator_id bigint, in_order_id bigint, in_order_revision bigint, in_dst_inventory_id bigint, in_dst_index bigint, in_count bigint, in_solaris_fee bigint, in_purge_time bigint → dune.duneexchangefulfillsellorderresult | — | Dune exchange fulfill sell order. |
| `dune_exchange_get_user_id` | in_owner_id bigint → bigint | — | Dune exchange get user id. |
| `dune_exchange_purge_completed_orders` | in_exchange_id bigint, in_current_time bigint → SETOF dune.exchangeexpiredorder | — | Dune exchange purge completed orders. |
| `dune_exchange_query_storage_item` | in_order_id bigint → TABLE(completion_type integer, id bigint, revision bigint, expiration_time bigint, access_point_id bigint, ap_name text, owner_id bigint, item_id bigint, template_id text, stack_size bigint, item_price bigint, quality_level bigint, durability_cur real, durability_max real, dynamic_stats jsonb) | — | Dune exchange query storage item. |
| `dune_exchange_query_storage_items` | in_exchange_id bigint, in_owner_id bigint → TABLE(completion_type integer, id bigint, revision bigint, expiration_time bigint, access_point_id bigint, ap_name text, owner_id bigint, item_id bigint, template_id text, stack_size bigint, item_price bigint, quality_level bigint, durability_cur real, durability_max real, dynamic_stats jsonb) | — | Dune exchange query storage items. |
| `dune_exchange_relist_order` | in_order_id bigint, in_expiration_time bigint, in_item_price bigint, in_wear_normalized_item_price bigint, in_solari_cost bigint → bigint | — | Dune exchange relist order. |
| `dune_exchange_retrieve_storage_item` | in_exchange_id bigint, in_order_id bigint, in_dst_inventory_id bigint, in_dst_index bigint, in_count bigint → dune.duneexchangeretrievestorageorderresult | — | Dune exchange retrieve storage item. |
| `dune_exchange_update_recurring_sell_order` | in_exchange_id bigint, in_expiration_time bigint, in_access_point_id bigint, in_owner_id bigint, in_item_id bigint, in_increment bigint, in_max_count bigint, in_category_mask integer, in_category_depth smallint, in_durability_cur real, in_durability_max real, in_item_price bigint, in_wear_normalized_item_price bigint, in_quality_level bigint → bigint | — | Dune exchange update recurring sell order. |
| `get_dune_exchange_accesspoint_id` | in_exchange_id bigint, in_name text → bigint | — | Get dune exchange accesspoint id. |
| `get_dune_exchange_data` | in_exchange_id bigint, in_controller_id bigint → dune.loadexchangedataresult | — | Get dune exchange data. |
| `get_dune_exchange_id` | in_name text → bigint | — | Get dune exchange id. |
| `get_dune_exchange_used_order_slots` | in_controller_id bigint → integer | — | Get dune exchange used order slots. |
| `get_exchange_inventory_id` | in_exchange_id bigint → bigint | — | Get exchange inventory id. |
| `get_exchange_orders_by_mask` | in_mask integer, in_depth smallint → SETOF bigint | — | Get exchange orders by mask. |
| `get_exchange_sell_orders` | in_id bigint, in_exchange_id bigint, in_min_item_price bigint, in_max_item_price bigint, in_template_id text, in_mask integer, in_depth smallint → TABLE(id bigint, revision bigint, expiration_time bigint, access_point_id bigint, ap_name text, owner_id bigint, template_id text, stack_size bigint, initial_stack_size bigint, item_price bigint, quality_level bigint, durability_cur real, durability_max real, dynamic_stats jsonb) | — | Get exchange sell orders. |
| `get_exchange_sell_orders_by_owner` | in_exchange_id bigint, in_owner_id bigint → TABLE(id bigint, revision bigint, expiration_time bigint, access_point_id bigint, ap_name text, owner_id bigint, template_id text, stack_size bigint, initial_stack_size bigint, item_price bigint, quality_level bigint, durability_cur real, durability_max real, dynamic_stats jsonb) | — | Get exchange sell orders by owner. |
| `try_update_exchange_categories_hash` | in_new_hash integer → TABLE(item_template_id text, mask integer, depth smallint) | — | Try update exchange categories hash. |

### faction

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `change_player_faction` | in_player_id bigint, in_faction_id smallint, neutral_faction_id smallint, in_utc_time_faction_change timestamp without time zone → void | `db.go:2239` | Switch a player's faction allegiance. |
| `clean_guild_invites_with_incompatible_faction` | in_player_id bigint, in_faction_id smallint, neutral_faction_id smallint → void | — | Clean guild invites with incompatible faction. |
| `get_all_faction_members` | () → TABLE(player_id bigint, fls_id text, faction_id smallint) | — | Get all faction members. |
| `get_player_current_faction_reputation` | in_actor_id bigint, OUT out_faction_id smallint, OUT out_reputation_amount integer → record | — | Get player current faction reputation. |
| `get_player_faction` | in_player_id bigint, in_neutral_faction_id smallint → smallint | — | Get player faction. |
| `get_player_faction_name` | in_actor_id bigint, OUT player_faction_name text, OUT utc_time_faction_change timestamp without time zone → record | — | Get player faction name. |
| `handle_player_faction_guild_effects` | in_player_id bigint, in_faction_id smallint, neutral_faction_id smallint → void | — | Handle player faction guild effects. |
| `register_new_factions` | factions text[] → TABLE(faction_id smallint, faction_name text) | — | Register new factions. |
| `set_player_faction_reputation` | in_actor_id bigint, in_faction_id smallint, in_reputation_amount integer → void | `db.go:995`<br>`db.go:1083`<br>`db.go:1497`<br>`db.go:2254` | Set a player's faction rep value directly (audited). |

### farm

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `delete_all_inactive_farms` | () → void | — | Delete all inactive farms. |
| `get_farm_state` | () → TABLE(server_id text, farm_id text, outgoing_s2s_connections integer, incoming_s2s_connections integer, connected_players integer, igw_addr inet, igw_port integer, game_addr inet, game_port integer, ready boolean, alive boolean, map text, revision integer) | — | Get farm state. |
| `set_all_inactive_players_in_farm_offline` | () → void | — | Set all inactive players in farm offline. |
| `update_farm_state` | in_server_id text, in_outgoing_s2s_connections integer, in_incoming_s2s_connections integer, in_connected_players integer, in_farm_id text, in_igw_addr inet, in_igw_port integer, in_ready boolean, in_alive boolean, in_game_addr inet, in_game_port integer, in_map text, in_revision integer → void | — | Update farm state. |

### guild

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `accept_guild_invite` | in_invite_id bigint, in_role_id smallint, in_max_guild_count_per_player integer, in_max_members_per_guild integer, in_neutral_faction_id smallint → void | — | Accept guild invite. |
| `add_guild_invite` | in_player_id bigint, in_guild_id bigint, in_sender_player_id bigint, in_invite_sent_timespan bigint, in_max_guild_invites_per_guild integer → void | — | Add guild invite. |
| `add_guild_member` | in_player_id bigint, in_guild_id bigint, in_role_id smallint, in_max_guild_count_per_player integer, in_max_members_per_guild integer, in_neutral_faction_id smallint → void | — | Add guild member. |
| `break_guild_allegiance` | in_guild_id bigint, in_neutral_faction_id smallint → void | — | Break guild allegiance. |
| `clean_old_guild_invites` | in_cutoff_timespan bigint → void | — | Clean old guild invites. |
| `create_guild` | in_player_id bigint, in_neutral_faction smallint, in_guild_name text, in_guild_desc text, in_max_guild_count_per_player integer, OUT out_guild_id bigint, OUT out_success boolean, OUT out_fail_reason dune.guildcreatefailreason → record | — | Create guild. |
| `demote_guild_member` | in_guild_id bigint, in_player_id bigint, in_new_role smallint → void | — | Demote guild member. |
| `disband_guild` | in_guild_id bigint → void | — | Disband guild. |
| `get_guild_data` | in_guild_id bigint → TABLE(guild_name text, guild_faction_id smallint, guild_description text) | — | Get guild data. |
| `get_guild_data_for_player` | in_player_id bigint → TABLE(guild_id bigint, guild_factions_id smallint, guild_name text, guild_description text, player_id bigint, role_id smallint, player_faction_id smallint) | — | Get guild data for player. |
| `get_guild_for_player` | in_player_id bigint → bigint | — | Get guild for player. |
| `get_guild_invites` | in_guild_id bigint → TABLE(invite_id bigint, player_id bigint, sender_player_id bigint, invite_sent_timespan bigint, character_name text, sender_character_name text) | — | Get guild invites. |
| `get_guild_members` | in_guild_id bigint → TABLE(player_id bigint, role_id smallint, player_faction_id smallint) | — | Get guild members. |
| `guild_handle_actor_delete` | in_player_id bigint → void | — | Guild handle actor delete. |
| `guilds_get_exclusive_operation_lock` | () → void | — | Guilds get exclusive operation lock. |
| `pledge_guild_allegiance` | in_guild_id bigint, in_guild_leader_player_id bigint, in_neutral_faction_id smallint → void | — | Pledge guild allegiance. |
| `promote_guild_member` | in_guild_id bigint, in_player_id bigint, in_new_role smallint → void | — | Promote guild member. |
| `reject_guild_invite` | in_invite_id bigint → void | — | Reject guild invite. |
| `remove_guild_members` | in_player_ids bigint[], in_guild_id bigint, in_remove_reason smallint → void | — | Remove guild members. |

### igwo

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `igwo_get_server_details` | () → TABLE(address text, server_id text, ready boolean, partition_id bigint, map text, dimension_index integer, label text) | — | Igwo get server details. |

### inventory

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `advance_items_id_sequencer` | count bigint → bigint | — | Advance items id sequencer. |
| `delete_inventory_item` | in_item_id bigint, in_count bigint → bigint | — | Partial delete (decrement count); removes when count hits 0. |
| `delete_item` | in_id bigint → void | `db.go:718` | Delete one inventory item by id. |
| `delete_items` | in_ids bigint[] → void | — | Delete a batch of inventory items by id. |
| `delete_items_from_actor` | in_actor_id bigint → void | — | Delete items from actor. |
| `drain_item_tracking_data` | () → TABLE(function_name dune.itemtrackingfunctiontype, item_id bigint, account_id bigint, inventory_id bigint, template_id text, event_time timestamp without time zone, position_index bigint) | — | Drain item tracking data. |
| `dune_exchange_get_item_price_stats` | in_template_ids text[] → TABLE(template_id text, minimum bigint, average bigint) | — | Dune exchange get item price stats. |
| `get_exchange_sell_orders_by_item_type` | in_exchange_id bigint, in_template_ids text[] → TABLE(id bigint, revision bigint, expiration_time bigint, access_point_id bigint, ap_name text, owner_id bigint, template_id text, stack_size bigint, initial_stack_size bigint, item_price bigint, quality_level bigint, durability_cur real, durability_max real, dynamic_stats jsonb) | — | Get exchange sell orders by item type. |
| `get_inventory_data` | in_inventory_id bigint → dune.inventorydata | — | Read inventory metadata. |
| `get_inventory_id` | in_actor_id bigint, in_component_name_hash integer → bigint | — | Get inventory id. |
| `load_item` | in_item_id bigint → TABLE(item_id bigint, stack_size bigint, quality_level bigint, volume_override real, position_index bigint, template_id text, inventory_id bigint, is_new boolean, acquisition_time bigint, stats jsonb, sub_inventory_id bigint) | — | Read a single item. |
| `load_items` | in_inventory_id bigint → TABLE(item_id bigint, stack_size bigint, quality_level bigint, volume_override real, position_index bigint, template_id text, inventory_id bigint, is_new boolean, acquisition_time bigint, stats jsonb, sub_inventory_id bigint) | — | Read all items in an inventory. |
| `merge_inventory_items` | in_item_id bigint, in_dst_inventory_id bigint, in_dst_index bigint, in_count bigint → bigint | — | Merge inventory items. |
| `merge_or_move_inventory_item` | in_item_id bigint, in_dst_inventory_id bigint, in_dst_index bigint, in_count bigint → bigint | — | Merge if possible, otherwise move. |
| `move_inventory_item` | in_item_id bigint, in_dst_inventory_id bigint, in_dst_index bigint, in_count bigint → bigint | — | Relocate an item within/between inventories. |
| `player_purchased_item_from_vendor` | in_vendor_id text, in_player_id bigint, in_template_id text, in_amount_bought integer → void | — | Player purchased item from vendor. |
| `save_item` | in_item dune.inventoryitem → void | — | Insert/update a single inventory item. |
| `set_item_tracking_enabled` | in_enabled boolean → void | — | Set item tracking enabled. |
| `update_inventory` | in_delete_list bigint[], in_stack_update dune.itemstackupdate[], in_quality_update dune.itemqualityupdate[], in_stat_update dune.itemstatupdate[], in_item_locations dune.inventoryitemlocation[] → void | — | Bulk inventory mutator (delete, stack, quality, stats, location lists). |
| `update_item_locations` | in_item_locations dune.inventoryitemlocation[] → void | — | Update item locations. |
| `verify_item_dup_backup_tool` | in_account_id bigint, in_vehicle_id bigint, in_cheat_type dune.cheat_type_enum → void | — | Anti-dup check around backup tool flow. |

### items_purge

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `get_items_to_remove` | items_to_remove text[] → text[] | — | Get items to remove. |
| `get_recipes_to_remove` | recipes_to_remove text[] → text[] | — | Get recipes to remove. |
| `remove_items` | items_to_remove text[] → void | — | Remove items. |
| `remove_items_and_recipes` | items_to_remove text[], recipes_to_remove text[] → void | — | Remove items and recipes. |
| `remove_items_or_recipes_from_fgl_entities` | item_or_recipes text[] → void | — | Remove items or recipes from fgl entities. |
| `remove_resourcefield_states` | in_map text, in_dimension_index integer, in_field_ids bigint[] → void | — | Remove resourcefield states. |
| `update_removed_items_and_recipes` | items_removed text[], recipes_removed text[] → void | — | Update removed items and recipes. |

### journey_progression

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `admin_get_mnemonic_recall_details` | in_account_id bigint → TABLE(mnemonic_recall_id bigint, lesson_id text, lesson_state bigint, lesson_progress integer) | — | Admin get mnemonic recall details. |
| `complete_journey_nodes_where_prerequisite_nodes_are_complete` | story_ids_to_complete text[], prerequisite_completed_story_ids text[] → void | — | Complete journey nodes where prerequisite nodes are complete. |
| `complete_journey_story_nodes_for_player` | in_player_id text, in_story_node_ids text[] → void | `db.go:2229` | Bulk-mark journey story nodes complete for a player. |
| `coriolis_cleanup_farm` | in_server_info dune.serverinfo, in_map_info dune.coriolismapinfo → void | — | Coriolis cleanup farm. |
| `coriolis_cleanup_partition` | in_server_info dune.serverinfo, in_map_info dune.coriolismapinfo → void | — | Coriolis cleanup partition. |
| `coriolis_update_seed` | in_server_info dune.serverinfo, in_new_coriolis_seed integer, in_map_info dune.coriolismapinfo → void | — | Coriolis update seed. |
| `create_or_update_tutorial_entry` | in_player_id bigint, in_tutorial_id smallint, in_tutorial_state smallint → void | — | Create or update tutorial entry. |
| `delete_all_journey_story_nodes` | in_account_id bigint → void | `db.go:1955` | Wipe all journey nodes for a player. |
| `delete_all_tutorial_entries` | in_player_id bigint → void | `db.go:2287` | Clear tutorial completion state for a player. |
| `delete_journey_story_ids` | story_ids text[] → void | — | Delete journey story ids. |
| `delete_journey_story_node` | in_account_id bigint, in_story_node_id text → void | — | Delete journey story node. |
| `delete_journey_story_nodes_for_group_for_player` | in_account_id bigint, in_reset_group dune.journeystoryresetgroup → void | — | Delete journey story nodes for group for player. |
| `delete_journey_story_nodes_for_player` | in_player_id text, in_story_node_ids text[] → void | — | Delete journey story nodes for player. |
| `delete_journey_story_nodes_for_player_account` | in_account_id bigint, in_story_node_ids text[] → void | — | Delete journey story nodes for player account. |
| `delete_mnemonic_recall_lesson` | in_account_id bigint, in_lesson_id text → void | — | Delete mnemonic recall lesson. |
| `delete_mnemonic_recall_lesson_all` | in_account_id bigint → void | `db.go:2304` | Wipe codex / mnemonic recall lessons. |
| `get_all_tutorial_entries` | in_player_id bigint → TABLE(tutorial_id smallint, tutorial_state smallint) | — | Get all tutorial entries. |
| `get_mnemonic_recall_lessons` | in_account_id bigint → TABLE(id bigint, lesson_id text, lession_state bigint, lesson_progress integer, is_new boolean) | — | Get mnemonic recall lessons. |
| `journey_story_node_cooldown_add` | in_account_id bigint, in_story_node_id text, in_time_to_expire timestamp without time zone → void | — | Journey story node cooldown add. |
| `journey_story_node_cooldown_delete_expired` | in_time_to_check timestamp without time zone → void | — | Journey story node cooldown delete expired. |
| `register_new_tutorials` | tutorials text[] → TABLE(tutorial_id smallint, tutorial_name text) | — | Register new tutorials. |
| `reset_journey_story_nodes_for_player` | in_player_id text, in_story_node_ids text[] → void | — | Reset journey story nodes for player. |
| `reveal_journey_story_nodes_for_player` | in_player_id text, in_story_node_ids text[] → void | — | Reveal journey story nodes for player. |
| `save_journey_story_node` | in_account_id bigint, in_story_node_id text, in_override_reward_block boolean, in_has_pending_reward boolean, in_complete_condition_state jsonb, in_reveal_condition_state jsonb, in_fail_condition_state jsonb, in_metadata_state jsonb, in_reset_group dune.journeystoryresetgroup → void | — | Save journey story node. |
| `save_journey_story_nodes` | in_account_id bigint, in_journey_data dune.savejourneydata[] → void | — | Save journey story nodes. |
| `save_mnemonic_recall_lesson` | in_account_id bigint, in_lesson_id text, in_lesson_state bigint, in_lesson_progress integer, in_is_new boolean → void | — | Save mnemonic recall lesson. |
| `update_coriolis_for_player` | in_controller_id bigint, OUT out_was_coriolis_processed boolean → boolean | — | Apply Coriolis storm processing for a player; returns whether processed. |
| `update_journey_story_ids` | old_story_ids text[], new_story_ids text[] → void | — | Update journey story ids. |

### landclaim

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `add_landclaim_segment` | in_totem_id bigint, in_grid_location_x bigint, in_grid_location_y bigint → void | — | Add landclaim segment. |
| `get_landclaim_segments` | in_totem_id bigint → TABLE(grid_location_x bigint, grid_location_y bigint) | — | Get landclaim segments. |

### landsraad

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `landsraad_cast_vote` | in_term_id bigint, in_player_id bigint, in_decree_name text → void | — | Landsraad cast vote. |
| `landsraad_change_term_end_time` | end_term_id bigint, new_end_time timestamp without time zone, in_test_term boolean → void | — | Landsraad change term end time. |
| `landsraad_check_task_completion` | () → trigger | — | Landsraad check task completion. |
| `landsraad_check_term_won` | () → trigger | — | Landsraad check term won. |
| `landsraad_collect_task_telemetry_for_faction` | in_term_id bigint, in_faction_name text → TABLE(task_telemetry dune.landsraadtermtasktelemetry[]) | — | Landsraad collect task telemetry for faction. |
| `landsraad_collect_term_telemetry` | in_term_id bigint, in_faction_names text[] → TABLE(term_telemetry dune.landsraadtermtelemetry[], task_telemetry dune.landsraadtermtasktelemetry[]) | — | Landsraad collect term telemetry. |
| `landsraad_collect_term_telemetry_for_faction` | in_term_id bigint, in_faction_name text → dune.landsraadtermtelemetry | — | Landsraad collect term telemetry for faction. |
| `landsraad_collect_vote_telemetry` | in_term_id bigint, in_winning_faction_id integer → TABLE(guild_id bigint, decree_name text, voting_influence integer) | — | Landsraad collect vote telemetry. |
| `landsraad_collect_votes` | in_term_id bigint → TABLE(elected_decree text, winning_faction_name text, available_decrees text[], guild_votes dune.landsraadguildvotetelemetry[]) | — | Landsraad collect votes. |
| `landsraad_determine_winner` | in_term_id bigint → text | — | Landsraad determine winner. |
| `landsraad_force_end_term` | end_term_id bigint → void | — | Landsraad force end term. |
| `landsraad_has_term_of_task_ended` | in_task_id bigint → boolean | — | Landsraad has term of task ended. |
| `landsraad_initialize_system` | number_of_weeks_term_retention integer, number_of_nominated_decrees integer, in_end_time timestamp without time zone, in_test_term boolean, faction_names text[], decrees dune.landsraaddecree[], tasks dune.landsraadtask[], task_rewards dune.landsraadtaskreward[] → TABLE(term_id bigint, reigning_faction_name text, active_decree_name text, winning_faction_name text, elected_decree_name text, start_time timestamp without time zone, end_time timestamp without time zone) | — | Landsraad initialize system. |
| `landsraad_initialize_term` | number_of_weeks_term_retention integer, number_of_nominated_decrees integer, in_end_time timestamp without time zone, in_test_term boolean, tasks dune.landsraadtask[], task_rewards dune.landsraadtaskreward[] → TABLE(term_id bigint, reigning_faction_name text, active_decree_name text, winning_faction_name text, elected_decree_name text, start_time timestamp without time zone, end_time timestamp without time zone) | — | Landsraad initialize term. |
| `landsraad_insert_task_progress` | in_term_id bigint, in_player_id bigint, in_guild_id bigint, in_house_name text, in_faction_progress integer, in_guild_progress real, in_player_progress real, in_timestamp timestamp without time zone → void | — | Landsraad insert task progress. |
| `landsraad_insert_task_progress_batched` | in_term_id bigint, in_task_progress dune.landsraadtaskprogress[] → void | — | Landsraad insert task progress batched. |
| `landsraad_insert_task_progress_faction` | in_term_id bigint, in_faction_name text, in_house_name text, in_faction_progress integer, in_guild_progress real, in_player_progress real → void | — | Landsraad insert task progress faction. |
| `landsraad_insert_task_progress_random` | in_term_id bigint, in_faction_names text[], in_num_rows integer → void | — | Landsraad insert task progress random. |
| `landsraad_insert_tasks` _(proc)_ | IN in_term_id bigint, IN in_tasks dune.landsraadtask[], IN in_task_rewards dune.landsraadtaskreward[] → void | — | Landsraad insert tasks. |
| `landsraad_load_current_rotation` | in_term_id bigint → TABLE(decree_name text, received_votes integer, open_votes integer) | — | Landsraad load current rotation. |
| `landsraad_load_current_term` | () → TABLE(term_id bigint, reigning_faction_name text, active_decree_name text, winning_faction_name text, elected_decree_name text, start_time timestamp without time zone, end_time timestamp without time zone, tasks dune.landsraadtask[], term_task_rewards dune.landsraadtaskreward[], winner_history text[], testterm boolean) | — | Landsraad load current term. |
| `landsraad_load_guild_contribution` | in_term_id bigint, in_guild_id bigint, in_faction_id bigint → TABLE(voting_influence real) | — | Landsraad load guild contribution. |
| `landsraad_load_guild_contributions` | in_term_id bigint, in_num_guilds integer, in_faction_names text[] → TABLE(faction_name text, guild_name text, voting_influence real) | — | Landsraad load guild contributions. |
| `landsraad_load_guild_vote` | in_term_id bigint, in_player_id bigint → TABLE(decree_name text, voting_influence real) | — | Landsraad load guild vote. |
| `landsraad_load_house_rewards` | in_player_id bigint → TABLE(house_name text, template_id text, amount integer, last_updated timestamp without time zone) | — | Landsraad load house rewards. |
| `landsraad_load_player_contributions` | in_term_id bigint, in_player_ids bigint[] → TABLE(player_id bigint, board_index smallint, amount integer) | — | Landsraad load player contributions. |
| `landsraad_load_task_faction_progress` | in_term_id bigint → TABLE(task_board_index integer, faction_name text, progress integer) | — | Landsraad load task faction progress. |
| `landsraad_load_task_faction_reveal_state` | in_term_id bigint → TABLE(task_board_index integer, faction_name text, reveal_state boolean, time_stamp timestamp without time zone) | — | Landsraad load task faction reveal state. |
| `landsraad_load_term_progress` | in_term_id bigint, in_num_guilds integer, in_faction_names text[], in_player_ids bigint[] → TABLE(faction_progress dune.landsraadtaskfactionprogress[], faction_reveal_state dune.landsraadtaskfactionrevealstate[], guild_contributions dune.landsraadguildcontribution[], player_contributions dune.landsraadplayercontribution[]) | — | Landsraad load term progress. |
| `landsraad_nominate_decrees_for_voting` _(proc)_ | IN last_active_decree_id bigint, IN num_decrees integer → void | — | Landsraad nominate decrees for voting. |
| `landsraad_notify_house_rewards_changed` | () → trigger | — | Landsraad notify house rewards changed. |
| `landsraad_perform_daily_task_reveal` | in_term_id bigint, in_faction_names text[], in_house_names_to_reveal text[], in_reveal_day integer → TABLE(faction_name text, house_name text, board_index integer) | — | Landsraad perform daily task reveal. |
| `landsraad_process_house_rewards` | () → trigger | — | Landsraad process house rewards. |
| `landsraad_process_task_progress` | max_rows integer → void | — | Landsraad process task progress. |
| `landsraad_task_has_been_completed` | in_task_id bigint → boolean | — | Landsraad task has been completed. |
| `landsraad_update_decrees` _(proc)_ | IN in_decrees dune.landsraaddecree[] → void | — | Landsraad update decrees. |
| `landsraad_update_factions` _(proc)_ | IN in_faction_names text[] → void | — | Landsraad update factions. |
| `landsraad_update_task_faction_reveal_state` | in_term_id bigint, in_task_board_index integer, faction_name text, reveal_state boolean → void | — | Landsraad update task faction reveal state. |
| `landsraad_withdraw_house_reward` | in_player_id bigint, in_house_rewards dune.landsraadplayerhousereward[] → void | — | Landsraad withdraw house reward. |

### lookup

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `admin_get_character_details` | in_account_id bigint → TABLE(account_id bigint, player_id text, character_name text, online_status text, last_avatar_activity timestamp with time zone, class text, map text, transform dune.transform, server_id text, partition_id bigint, partition_label text, dimension_index integer, gas_attributes jsonb, properties jsonb, slot_name text, fgl_data text) | — | Admin get character details. |
| `admin_get_character_ids` | in_search_term text → TABLE(id bigint, "user" text, character_name text) | — | Admin player search by partial name/id. |
| `admin_get_inventory_details` | in_account_id bigint → TABLE(inventory_id bigint, item_id bigint, stack_size integer, template_id text, acquisition_time bigint) | — | Admin: read inventory for an account. |
| `admin_get_journey_details` | in_player_id text, in_story_node_id text → TABLE(out_story_node_id text, out_override_reward_block boolean, out_has_pending_reward boolean, out_complete_condition_state jsonb, out_reveal_condition_state jsonb, out_fail_condition_state jsonb, out_metadata_state jsonb, out_reset_group dune.journeystoryresetgroup) | — | Admin get journey details. |
| `admin_get_partitions` | () → TABLE(out_partition_id bigint, out_server_id text, out_partition_definition jsonb, out_dimension_index integer, out_blocked boolean, out_label text, out_map text) | — | Admin get partitions. |
| `admin_move_offline_player` | in_fls_id text, in_target_partition_name text, in_target_location dune.vector → void | — | Admin move offline player. |
| `admin_move_offline_player_to_partition` | in_fls_id text, in_target_partition_id bigint, in_target_location dune.vector → void | `db.go:3341` | Admin move offline player to partition. |
| `admin_read_player_tags` | in_account_id bigint → TABLE(tags text) | — | Read tags for an account (admin). |
| `dune_get_account_id_by_user` | in_user text → bigint | — | Resolve FLS id → account id. |
| `fetch_resourcefield_state` | in_map text, in_dimension_index integer, in_field_kind_id smallint → TABLE(field_id bigint, spawn_time double precision, value_remaining bigint) | — | Fetch resourcefield state. |
| `fetch_server_spice_field_manifest` | in_server_id text → TABLE(spicefield_type_id integer, inactive_fields_of_type integer, requested_spawned_of_type integer) | — | Fetch server spice field manifest. |
| `fetch_spicefie_id_types_with_global_info` | in_map_name text, in_dimension_index integer → TABLE(spicefield_type_id integer, max_globally_active integer, max_globally_primed integer, current_globally_active integer, current_globally_primed integer, is_spawning_active boolean, field_type text) | — | Fetch spicefie id types with global info. |
| `get_all_demo_players` | () → TABLE(fls_ids text) | — | Get all demo players. |
| `get_all_guild_members` | () → TABLE(player_id bigint, fls_id text, guild_id bigint) | — | Get all guild members. |
| `get_all_online_or_recently_disconnected_player_online_state` | () → SETOF dune.playeronlinestateentry | — | Get all online or recently disconnected player online state. |
| `get_all_parties` | () → TABLE(party_id bigint, player_id bigint, player_name text, party_leader_id bigint, platform_session_id text, platform_name text, platform_players_count integer) | — | Get all parties. |
| `get_all_party_invites` | () → TABLE(invite_id bigint, party_id bigint, sender_player_id bigint, sender_name text, player_id bigint, player_name text, invite_sent_timespan bigint) | — | Get all party invites. |
| `get_all_party_members` | () → TABLE(player_id bigint, fls_id text, party_id bigint) | — | Get all party members. |
| `get_all_player_character_home_dimensions` | () → TABLE(fls_id text, home_dimension integer) | — | Get all player character home dimensions. |
| `get_all_player_in_guild_online_state` | in_guild_id bigint → SETOF dune.playeronlinestateentry | — | Get all player in guild online state. |
| `get_all_player_travel_states` | () → TABLE(fls_id text, login_target_dimension_index integer) | — | Get all player travel states. |
| `get_all_unresolved_character_imports` | () → TABLE(flsid text, importstate dune.transferimportstate, lastupdatetime timestamp with time zone) | — | Get all unresolved character imports. |
| `get_best_dungeon_completion` | in_dungeon_id text → TABLE(out_difficulty integer, out_duration_ms integer, out_players_names text[]) | — | Get best dungeon completion. |
| `get_best_dungeons_completions_for_player` | in_player_id bigint → TABLE(out_dungeon_id text, out_difficulty integer, out_duration_ms integer, out_players_num smallint) | — | Get best dungeons completions for player. |
| `get_character_import_state` | in_fls_id text → dune.transferimportstate | — | Get character import state. |
| `get_learned_building_sets` | in_account_id bigint → SETOF text | — | Get learned building sets. |
| `get_learned_new_buildable_pieces` | in_account_id bigint → SETOF text | — | Get learned new buildable pieces. |
| `get_login_journey_nodes` | in_account_id bigint → dune.journeynodeinfo[] | — | Get login journey nodes. |
| `get_login_journey_nodes_cooldown` | in_account_id bigint → dune.journeynodecooldowninfo[] | — | Get login journey nodes cooldown. |
| `get_online_player_controller_ids` | in_map text → SETOF bigint | — | Get online player controller ids. |
| `get_online_player_controller_ids_on_farm` | () → SETOF bigint | — | Get online player controller ids on farm. |
| `get_player_access_codes` | in_account_id bigint → TABLE(access_code integer, access_code_type integer) | — | Get player access codes. |
| `get_player_guild_invites` | in_player_id bigint → TABLE(invite_id bigint, guild_id bigint, guild_name text, guild_description text, sender_player_id bigint, invite_sent_timespan bigint, character_name text, sender_character_name text) | — | Get player guild invites. |
| `get_player_ids_online_state` | in_player_ids bigint[] → SETOF dune.playeronlinestateentry | — | Get player ids online state. |
| `get_player_infos_for_actor_ids` | in_actor_ids bigint[] → TABLE(player_id bigint, character_name text, fls_id text, funcom_id text, platform_id text, platform_name text) | — | Get player infos for actor ids. |
| `get_player_infos_for_character_names` | in_character_names text[] → TABLE(player_id bigint, character_name text, fls_id text, funcom_id text, platform_id text, platform_name text) | — | Get player infos for character names. |
| `get_player_infos_for_fls_ids` | in_fls_ids text[] → TABLE(player_id bigint, character_name text, fls_id text, funcom_id text, platform_id text, platform_name text) | — | Get player infos for fls ids. |
| `get_player_infos_for_funcom_ids` | in_funcom_ids text[] → TABLE(player_id bigint, character_name text, fls_id text, funcom_id text, platform_id text, platform_name text) | — | Get player infos for funcom ids. |
| `get_player_online_state_within_grace_period_for_each_server` | () → TABLE(fls_id text, previous_partition_id bigint, current_server_id text, online_status dune.playerconnectionstatus, within_grace_period boolean, last_disconnect timestamp without time zone, demo_playtime_seconds integer, logoff_persistence_end_time timestamp without time zone, party_id bigint) | — | Get player online state within grace period for each server. |
| `get_player_partition_id` | in_fls_id text → bigint | — | Get player partition id. |
| `get_player_pawn` | in_account_id bigint → TABLE(description dune.actordescription, server_info dune.serverinfo, player_tags text[]) | — | Get player pawn. |
| `get_players_demo_data` | in_controller_ids bigint[] → SETOF dune.playerdemostatedescription | — | Get players demo data. |
| `get_traveling_actor_id_and_types` | in_actor_id bigint → TABLE(id bigint, is_instigator boolean, is_player boolean, level integer) | — | Get traveling actor id and types. |
| `get_traveling_actor_ids` | in_actor_id bigint, in_max_recursion_level integer → TABLE(id bigint, is_instigator boolean, level integer) | — | Get traveling actor ids. |
| `get_traveling_actors_fls_ids` | in_actor_id bigint → TABLE(out_id text) | — | Get traveling actors fls ids. |
| `get_traveling_non_player_actor_ids` | in_actor_id bigint → TABLE(id bigint) | — | Get traveling non player actor ids. |
| `is_player_guild_admin` | in_player_id bigint, in_guild_id bigint → boolean | — | Is player guild admin. |
| `is_player_offline` | in_fls_id text → boolean | — | Return true if player has no live session. |
| `is_player_party_leader` | in_player_id bigint, in_party_id bigint → boolean | — | Is player party leader. |

### map_areas

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `add_map_areas_surveyed_items` | in_account_id bigint, in_area_id smallint, in_survey_point_marker_id bigint, in_surveyed_items_target jsonb, in_surveyed_items_progress jsonb, in_map_name text → void | — | Add map areas surveyed items. |
| `add_map_areas_time_discovered` | in_account_id bigint, in_area_id smallint, in_time_discovered timestamp without time zone, in_map_name text → void | — | Add map areas time discovered. |
| `add_map_areas_time_first_entered` | in_account_id bigint, in_area_id smallint, in_time_first_entered timestamp without time zone, in_map_name text → void | — | Add map areas time first entered. |
| `clear_map_areas_data_for_player` | in_id bigint → void | — | Clear map areas data for player. |
| `create_sinkchart_for_map_area_id` | in_item_id bigint, in_creator_id bigint, in_map_name text, in_area_id smallint → integer | — | Create sinkchart for map area id. |
| `delete_crafted_map` | in_item_id bigint → void | — | Delete crafted map. |
| `delete_world_partition_by_map_id` | in_map_id text → void | — | Delete world partition by map id. |
| `load_map_areas_entries` | in_account_id bigint, in_map_name text → TABLE(account_id bigint, area_id smallint, time_discovered timestamp without time zone, time_first_entered timestamp without time zone, survey_point_marker_id bigint, items_surveyed_target jsonb, items_surveyed_progress jsonb, map_name text) | — | Load map areas entries. |
| `overmap_delete_player_survival_data` | in_player_id bigint → void | — | Overmap delete player survival data. |
| `overmap_load_player_survival_data` | in_player_id bigint → TABLE(out_vehicle_id bigint, out_has_polar_psu boolean, out_overmap_location dune.vector) | — | Overmap load player survival data. |
| `overmap_save_player_survival_data` | in_player_id bigint, in_vehicle_id bigint, in_has_polar_psu boolean, in_overmap_location dune.vector → void | — | Overmap save player survival data. |
| `use_sinkchart` | in_player_id bigint, in_account_id bigint, in_area_id smallint, in_item_id bigint, in_sinkchart_map_name text, in_player_map_name text, in_player_current_dimension integer → dune.usesinkchartreturndata | — | Use sinkchart. |

### markers

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `delete_map_markers` | in_dimension_index integer, in_map_name text, in_player_marker_data dune.deleteplayermarkerdata[] → void | — | Delete map markers. |
| `delete_markers_by_id` | in_marker_ids integer[] → void | — | Delete markers by id. |
| `delete_markers_by_static_location_key` | p_location_key text → void | — | Delete markers by static location key. |
| `delete_markers_for_all_players` | in_marker_types_to_keep text[], in_map text → void | — | Delete markers for all players. |
| `delete_static_location_markers` | p_location_keys text[] → void | — | Delete static location markers. |
| `load_markers` | in_player_id bigint, in_dimension_id integer, in_map_name text → TABLE(out_marker_hash_id integer, out_marker_type text, out_x double precision, out_y double precision, out_z double precision, out_payload_type text, out_area_id smallint, out_area_radius real, out_long_range boolean, out_payload jsonb, out_discovery_level smallint, out_discovery_method smallint, out_player_payload jsonb) | — | Load markers. |
| `save_markers` | in_player_marker_data dune.saveplayermarkerdata[], in_marker_data dune.savemarkerdata[] → void | — | Save markers. |
| `update_marker_ids` | in_old_ids integer[], in_new_ids integer[] → void | — | Update marker ids. |

### misc

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `corilis_cleanup_map` | in_server_info dune.serverinfo, in_map_info dune.coriolismapinfo → void | — | Corilis cleanup map. |
| `downgrade_map_name` | in_map_name text → text | — | Downgrade map name. |
| `fix_broken_harkonnen_players_due_to_fooled_thufir` | () → void | — | Fix broken harkonnen players due to fooled thufir. |
| `get_consumed_lore_pickups` | in_actor_id bigint, in_use_temporary boolean → SETOF bit | — | Get consumed lore pickups. |
| `get_controller_id_from_platform_id` | in_platform_id text → bigint | — | Get controller id from platform id. |
| `get_friends_search` | in_player_name text, in_max_players_count integer → TABLE(player_id bigint, character_name text, funcom_id text, platform_id text, platform_name text) | — | Get friends search. |
| `get_sub_inventory_id` | in_owner_item_id bigint → bigint | — | Get sub inventory id. |
| `load_dimension_index` | in_map text, in_partition_id bigint → integer | — | Load dimension index. |
| `load_events_log_data_from_player` | in_actor_id bigint, in_limit_entries_num integer → TABLE(game_event_owner bigint, universe_time timestamp without time zone, map_name text, partition_id bigint, event_type integer, x_location double precision, y_location double precision, z_location double precision, custom_data jsonb) | — | Load events log data from player. |
| `load_static_encounter_name` | in_map_name text, in_package_name text, in_actor_name text → TABLE(encounter_name text, waiting_for_reset boolean) | — | Load static encounter name. |
| `parties_get_exclusive_operation_lock` | () → void | — | Parties get exclusive operation lock. |
| `remove_members_offline_for` | in_interval_seconds integer → void | — | Remove members offline for. |
| `save_login_target_dimension` | in_fls_id text, in_login_target_dimension_index integer → void | — | Save login target dimension. |
| `save_static_encounter_name` | in_map_name text, in_package_name text, in_actor_name text, in_encounter_name text → void | — | Save static encounter name. |
| `save_static_encounter_waiting_for_reset` | in_map_name text, in_package_name text, in_actor_name text, in_waiting_for_reset boolean → void | — | Save static encounter waiting for reset. |
| `update_consumed_per_player_lore` | in_actor_id bigint, in_consumed_bit_array bit, in_use_temporary boolean → void | — | Update consumed per player lore. |
| `update_inventories_data` | in_inventory_data_list dune.inventorydata[] → void | — | Update inventory metadata for a list. |
| `update_resourcefield_states` | in_map text, in_dimension_index integer, in_field_kind_id smallint, in_field_states dune.resourcefieldstateentry[] → void | — | Update resourcefield states. |
| `update_sell_orders_categories` | category_update_data dune.exchangecategoryupdatedata[] → void | — | Update sell orders categories. |
| `upgrade_location_data_list` | in_location_data_list jsonb, in_map_field_name text → jsonb | — | Upgrade location data list. |
| `upgrade_map_name` | in_map_name text → text | — | Upgrade map name. |
| `upgrade_map_value` | in_value jsonb → jsonb | — | Upgrade map value. |
| `zero_transform` | () → dune.transform | — | Zero transform. |

### partition

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `add_partition_unique` | in_map text, in_definition jsonb, in_dimension bigint, in_label text → bigint | — | Add partition unique. |
| `determine_partition_label` | in_map text, in_dimension_index integer, in_label text, in_allow_overwrite boolean, in_partition_id bigint → text | — | Determine partition label. |
| `determine_partition_label_trigger` | () → trigger | — | Determine partition label trigger. |
| `get_partition_presets` | () → SETOF text | — | Adds a partition only if its unique. Not using constraints, as this is only a helper function. |
| `get_partitions` | in_map text → SETOF bigint | — | Get partitions. |
| `igwo_delete_world_partitions` | in_partition_ids bigint[] → void | — | Igwo delete world partitions. |
| `igwo_get_partition_id_seq_last_value` | () → bigint | — | Igwo get partition id seq last value. |
| `igwo_get_partition_ids` | () → SETOF bigint | — | Igwo get partition ids. |
| `igwo_get_partitions` | () → TABLE(partition_id bigint, map text, dimension_index integer, label text, min_x double precision, min_y double precision, max_x double precision, max_y double precision) | — | Igwo get partitions. |
| `igwo_insert_world_partition` | in_partition_id bigint, in_map text, in_partition_definition jsonb, in_dimension_index integer, in_partition_label text → bigint | — | Igwo insert world partition. |
| `igwo_next_partition_id_seq` | () → bigint | — | Igwo next partition id seq. |
| `igwo_notify_world_partition_update` | () → void | — | Igwo notify world partition update. |
| `igwo_restart_partition_id_seq` | in_restart_with bigint → void | — | Igwo restart partition id seq. |
| `igwo_update_world_partition` | in_map text, in_partition_definition jsonb, in_partition_id bigint, in_dimension_index integer, in_label text → void | — | Igwo update world partition. |
| `initialize_partitions_basic_battlegroup` | () → void | — | Initialize partitions basic battlegroup. |
| `initialize_partitions_basic_survival_1` | () → void | — | Initialize partitions basic survival 1. |
| `initialize_partitions_development_battlegroup` | () → void | — | Initialize partitions development battlegroup. |
| `initialize_partitions_editor_default_1x1` | () → void | — | Initialize partitions editor default 1x1. |
| `initialize_partitions_full_battlegroup` | () → void | — | Initialize partitions full battlegroup. |
| `initialize_partitions_igw_test_small_2x1` | () → void | — | Initialize partitions igw test small 2x1. |
| `initialize_partitions_igw_test_small_2x2` | () → void | — | Initialize partitions igw test small 2x2. |
| `initialize_partitions_igw_training` | () → void | — | Initialize partitions igw training. |
| `initialize_world_partition` | in_map_name text, in_num_servers integer, in_dimension_index integer → SETOF bigint | — | Initialize world partition. |
| `load_partition_definition_map` | () → TABLE(out_partition_id bigint, out_server_id text, out_partition_definition jsonb, out_dimension_index integer, out_blocked boolean, out_label text, out_map text) | — | Load partition definition map. |
| `load_world_partition` | in_map_name text, in_server_id text, in_desired_dimension_index bigint, in_desired_partition_id bigint → TABLE(partition_id bigint, partition_definition jsonb, dimension_index integer, blocked boolean, label text) | — | Load world partition. |
| `save_world_partition` | in_map_name text, in_server_id text, in_dimension_index bigint, in_partition_definition jsonb, in_blocked boolean, in_label text → bigint | — | Save world partition. |
| `unassign_partition` | in_server_id text → boolean | — | Unassign partition. |
| `update_partition_labels` | in_allow_overwrite boolean → void | — | Update partition labels. |

### party

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `accept_party_invite` | in_invite_id bigint, in_platform_session_id text, in_max_party_member_count integer → dune.partyacceptinviteresult | — | Accept party invite. |
| `add_party_invite` | in_sender_player_id bigint, in_sender_platform_name text, in_sender_platform_session_id text, in_player_id bigint, in_max_party_member_count integer, in_invite_sent_timespan bigint → void | — | Add party invite. |
| `clean_expired_party_invites` | in_invite_expire_seconds integer → void | — | Clean expired party invites. |
| `disband_party` | in_party_id bigint → void | — | Disband party. |
| `get_party_members` | in_party_id bigint → TABLE(player_id bigint, fls_id text, party_id bigint) | — | Get party members. |
| `internal_add_party_member` | in_invite_id bigint, in_party_id bigint, in_player_id bigint, in_platform_session_id text, in_platform_name text, in_max_party_member_count integer → dune.partyacceptinviteresult | — | Internal add party member. |
| `internal_create_party` | in_invite_id bigint, in_leader_id bigint, in_leader_platform_session_id text, in_leader_platform_name text, in_member_id bigint, in_platform_session_id text, in_platform_name text → bigint | — | Internal create party. |
| `join_platform_session_party` | in_leader_platform_id text, in_player_platform_id text, in_platform_session_id text, in_platform_name text, in_max_party_member_count integer → dune.partyacceptinviteresult | — | Join platform session party. |
| `promote_new_party_leader` | in_party_id bigint → void | — | Promote new party leader. |
| `promote_party_leader_to` | in_party_id bigint, in_player_id bigint → void | — | Promote party leader to. |
| `remove_party_invite` | in_invite_id bigint, in_remove_reason smallint → void | — | Remove party invite. |
| `remove_party_member` | in_player_id bigint, in_remove_reason smallint → void | — | Remove party member. |
| `update_party_platform_session` | in_party_id bigint, in_platform_session_id text, in_platform_name text → void | — | Update party platform session. |

### permission

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `get_actors_location_data_with_permission` | in_actor_ids bigint[] → SETOF dune.actorpermissionlocationdata | — | Get actors location data with permission. |
| `get_permission_actors_for_server` | in_server_info dune.serverinfo → SETOF dune.actorpermissioncombineddata | — | Get permission actors for server. |
| `get_permission_for_actor` | in_actor_id bigint → dune.actorpermissioncombineddata | — | Get permission for actor. |
| `get_permission_for_actors` | in_actor_id bigint[] → SETOF dune.actorpermissioncombineddata | — | Get permission for actors. |
| `get_permission_for_player_actors` | in_player_id bigint, in_min_rank smallint → SETOF dune.actorpermissioncombineddata | — | Get permission for player actors. |
| `permission_actor_create_or_update_base_marker` | in_actor_id bigint, in_player_id bigint, in_rank smallint → void | — | Permission actor create or update base marker. |
| `permission_actor_destroy` | in_actor_id bigint → void | — | Permission actor destroy. |
| `permission_actor_register` | in_entry dune.actorpermissionentry, in_owner_rank dune.actorpermissionrankdata → void | — | Permission actor register. |
| `permission_actor_takeover` | in_entry dune.actorpermissionentry, in_owner_rank dune.actorpermissionrankdata → void | — | Permission actor takeover. |
| `permission_actor_update_marker_location` | in_actor_id bigint, in_location_x real, in_location_y real, in_location_z real → void | — | Permission actor update marker location. |
| `permission_remove_player_rank` | in_actor_id bigint, in_player_id bigint → void | — | Permission remove player rank. |
| `permission_set_access_level` | in_actor_id bigint, in_access_level smallint → void | — | Permission set access level. |
| `permission_set_name` | in_actor_id bigint, in_name text → void | — | Permission set name. |

### player_persistence

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `_add_item_delete_log` | in_item_id bigint, in_inventory_id bigint, in_template_id text → void | — | Add item delete log. |
| `_add_item_trace_log` | in_function_name dune.itemtrackingfunctiontype, in_item_locations dune.inventoryitemlocation[] → void | — | Add item trace log. |
| `_add_item_trace_log` | in_function_name dune.itemtrackingfunctiontype, in_item_id bigint, in_inventory_id bigint, in_template_id text, in_position_index bigint → void | — | Add item trace log. |
| `perform_notify_on_character_delete` | in_user_id text → void | — | Perform notify on character delete. |
| `record_logoff_persistence_end_time` | in_player_pawn_id bigint, in_logoff_persistence_end_time timestamp without time zone → void | — | Record logoff persistence end time. |
| `save_player` | in_player dune.playerdescription → boolean | — | Save player. |
| `save_player_pawn` | in_pawn dune.actordescription, in_server_info dune.serverinfo, in_life_state dune.playerlifestate → boolean | — | Save player pawn. |
| `save_tracked_journey_cards` | in_player_id bigint, in_tracked_journey_card text, in_tracked_landsraad_card text → void | — | Save tracked journey cards. |
| `update_death_location` | in_pawn dune.actordescription, in_server_info dune.serverinfo, in_life_state dune.playerlifestate → void | — | Update death location. |

### schema_meta

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `get_applied_patches` | () → SETOF text | — | Get applied patches. |
| `get_schema_version` | () → integer | — | Get schema version. |
| `get_universe_time` | () → TABLE(universe_time_timestamp timestamp without time zone, down_time_accumulation bigint) | — | Get universe time. |
| `save_demo_account_time` | in_fls_id text, in_demo_playtime_seconds integer → void | — | Save demo account time. |
| `set_demo_state` | in_user_id text, in_demo_state dune.demostate → void | — | Set demo state. |
| `update_universe_time` | in_farm_id text → TABLE(universe_time_timestamp timestamp without time zone, down_time_accumulation bigint) | — | Update universe time. |

### server

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `create_server_player_access_codes` | in_account_id bigint, in_access_code integer, in_access_code_type integer, in_is_resettable boolean → void | — | Create server player access codes. |
| `delete_server_player_access_codes` | in_account_id bigint, in_access_code integer, in_access_code_type integer → void | — | Delete server player access codes. |
| `get_active_servers_for_gateway` | () → TABLE(server_id text, map text, partition_id bigint, dimension_index integer, game_addr inet, game_port integer, revision integer) | — | Used by the gateway service to monitor for active servers. |
| `mark_server_dead` | in_server_id text → void | — | Mark server dead. |
| `register_lore_pickup` | in_lore_pickup_ids text[] → SETOF smallint | — | Register lore pickup. |
| `register_per_player_lore_pickup` | in_lore_pickup_ids text[], in_use_temporary boolean → SETOF smallint | — | Register per player lore pickup. |
| `register_temporary_lore_pickup` | in_lore_pickup_ids text[] → SETOF smallint | — | Register temporary lore pickup. |
| `server_info_match` | in_actor dune.actors, in_server_info dune.serverinfo → boolean | — | Server info match. |
| `update_server_learned_new_buildable_pieces` | in_account_id bigint, in_new_buildable_pieces text[] → void | — | Update server learned new buildable pieces. |

### shifting_sand

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `delete_all_static_shifting_sand` | () → void | — | Delete all static shifting sand. |
| `record_static_shifting_sand` | in_id text, in_alpha double precision, in_x double precision, in_y double precision, in_last_modified_time bigint → void | — | Record static shifting sand. |
| `retrieve_all_static_shifting_sand` | () → TABLE(out_id text, out_alpha double precision, out_x double precision, out_y double precision, out_last_modified_time bigint) | — | Retrieve all static shifting sand. |

### spawner

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `delete_spawner` | in_map text, in_name text, in_dimension_index integer → void | — | Delete spawner. |
| `get_respawn_locations` | in_account_id bigint → dune.respawnlocation[] | — | Get respawn locations. |
| `get_spawner_id` | in_map text, in_name text, in_dimension_index integer → bigint | — | Get spawner id. |
| `update_respawn_locations` | player_id bigint, respawn_locations dune.respawnlocation[] → void | — | Update respawn locations. |

### spice_field

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `produce_spicefield_manifest` | in_map_name text, in_dimension_index integer → TABLE(server text, type_id integer, inactive_fields integer, requested_fields integer) | — | Produce spicefield manifest. |
| `record_deactivated_spice_field` | in_server_id text, in_spicefield_type_id integer → void | — | Record deactivated spice field. |
| `record_unreadied_spice_fields` | in_server_id text, in_spicefield_type_id integer, in_num_unreadied integer → void | — | Record unreadied spice fields. |
| `register_spice_field_server_resources` | in_server_id text, in_spicefield_type_ids integer[], in_inactive_fields_of_types integer[] → void | — | Register spice field server resources. |
| `request_spawn_spice_field` | in_server_id text, in_spicefield_type_id integer → void | — | Request spawn spice field. |
| `reset_global_spice_field_state` | in_map_name text, in_dimension_index integer → void | — | Reset global spice field state. |
| `try_prime_spicefield` | in_source_server_id text, in_spicefield_id integer → boolean | — | Try prime spicefield. |
| `try_restart_spicefield` | in_server_id text, in_spicefield_type_id integer → boolean | — | Try restart spicefield. |
| `try_spawn_spicefield` | in_source_server_id text, in_spicefield_id integer → boolean | — | Try spawn spicefield. |
| `update_global_spice_field_rules` | in_max_globally_primed integer, in_max_globally_active integer, in_spicefield_type_id integer → void | — | Update global spice field rules. |
| `update_spice_field_spawn_state` | in_is_spawning_active boolean, in_spicefield_type_id integer → void | — | Update spice field spawn state. |
| `upsert_spicefield_types` | in_max_globally_active integer[], in_max_globally_primed integer[], in_field_types text[], in_map_name text, in_dimension_index integer → TABLE(type_id integer, max_global integer, max_global_primed integer, spawning_active boolean, out_field_type text) | — | Upsert spicefield types. |

### stock_vendor

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `clean_stock_for_player` | in_player_id bigint → void | — | Clean stock for player. |
| `clean_stock_for_vendors` | in_vendor_ids text[] → void | — | Clean stock for vendors. |
| `clean_vendors_older_than_timestamp` | in_reference_timestamp bigint → void | — | Clean vendors older than timestamp. |
| `interact_get_vendor_items_bought_from_player` | in_vendor_id text, in_player_id bigint, in_current_cycle_start_timestamp bigint → TABLE(out_template_id text, out_amount_bought integer) | — | Interact get vendor items bought from player. |
| `update_vendor_timestamp_for_player` | in_vendor_id text, in_player_id bigint, in_timestamp bigint → void | — | Update vendor timestamp for player. |

### takeover

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `load_takeoverable_user_ids` | () → SETOF dune.takeovercharacterdatacomposite | — | Load takeoverable user ids. |
| `set_account_as_takeoverable` | in_user_id text, in_new_user_id text → void | — | Set account as takeoverable. |
| `takeover_account` | in_user_to_takeover text, in_current_user text → void | — | Takeover account. |

### taxation

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `taxation_emit_invoices` | new_tax_invoices dune.taxinvoicedata[] → void | — | Taxation emit invoices. |
| `taxation_get_all_invoices_for_player` | in_player_id bigint → TABLE(id bigint, totem_id bigint, reference_timestamp bigint, invoice_status smallint, amount integer, actor_name text) | — | Taxation get all invoices for player. |
| `taxation_get_all_invoices_for_server` | map_name text, in_dimension_index integer, in_partition_id bigint → TABLE(id bigint, totem_id bigint, reference_timestamp bigint, invoice_status smallint, amount integer, actor_name text) | — | Taxation get all invoices for server. |
| `taxation_get_all_invoices_for_totem` | in_totem_id bigint → TABLE(id bigint, totem_id bigint, reference_timestamp bigint, invoice_status smallint, amount integer, actor_name text) | — | Taxation get all invoices for totem. |
| `taxation_pay_invoice` | invoice_id bigint, paid_invoice_status smallint → bigint | — | Taxation pay invoice. |
| `taxation_remove_invoices` | invoices_to_remove bigint[] → void | — | Taxation remove invoices. |
| `taxation_remove_invoices_from_totem` | totem_actor_id bigint → void | — | Taxation remove invoices from totem. |
| `taxation_update_invoice_status` | invoices_to_overdue bigint[], invoices_to_defaulted bigint[], overdue_invoice_status smallint, defaulted_invoice_status smallint → void | — | Taxation update invoice status. |

### transfer

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `_character_transfer_allocate_id` | kind dune._charactertransferentrykind, data jsonb → bigint | — | Character transfer allocate id. |
| `_character_transfer_create_data_table` | () → void | — | Character transfer create data table. |
| `_character_transfer_data_filter` | id text, removed text[], VARIADIC refs dune._charactertransferdatafilterref[] → dune._charactertransferdatafilter | — | Character transfer data filter. |
| `_character_transfer_data_table_load` | entries jsonb → void | — | Character transfer data table load. |
| `_character_transfer_data_table_save` | () → jsonb | — | Character transfer data table save. |
| `_character_transfer_get_filter` | kind dune._charactertransferentrykind → dune._charactertransferdatafilter | — | Character transfer get filter. |
| `_character_transfer_get_patches_checksum` | () → text | — | Character transfer get patches checksum. |
| `_character_transfer_pre_export_validation` | in_fls_id text → TABLE(out_acc_id bigint, out_funcom_id text, out_player_controller_id bigint, out_player_pawn_id bigint) | — | Character transfer pre export validation. |
| `_character_transfer_property_not_exported_is_expected` | path text → boolean | — | Character transfer property not exported is expected. |
| `_character_transfer_replace_local_id_with_transfer_id` | data text, path text → text | — | Character transfer replace local id with transfer id. |
| `_character_transfer_replace_local_id_with_transfer_id_in_json` | data jsonb, path text → jsonb | — | Character transfer replace local id with transfer id in json. |
| `_character_transfer_replace_transfer_id_with_local_id` | data text, path text → text | — | Character transfer replace transfer id with local id. |
| `_character_transfer_replace_transfer_id_with_local_id_in_json` | data jsonb, path text → jsonb | — | Character transfer replace transfer id with local id in json. |
| `_character_transfer_top_level_export` | in_kind dune._charactertransferentrykind, data jsonb → jsonb | — | Character transfer top level export. |
| `_character_transfer_top_level_import` | in_kind dune._charactertransferentrykind, data jsonb, in_id bigint → jsonb | — | Character transfer top level import. |
| `can_takeover_account` | in_user_id text → boolean | — | Can takeover account. |
| `character_migration_export` | in_fls_id text → jsonb | — | Export character for migration. |
| `character_migration_import` | in_data jsonb, in_fls_id text, in_character_name text → bigint | — | Character migration import. |
| `character_transfer_export` | in_fls_id text → jsonb | `handlers_players.go:522` | Export a character (incl. inventory, journey, etc.) as jsonb. |
| `character_transfer_get_unsaved_counts` | in_fls_id text → TABLE(unsaved_bases_count bigint, unsaved_vehicles_count bigint) | — | Pre-transfer counts of unsaved bases/vehicles. |
| `character_transfer_import` | in_data jsonb, in_fls_id text, in_character_name text → bigint | — | Import a jsonb character payload; returns new account id. |
| `cleanup_account_log_and_orphaned_actors` | () → void | — | Cleanup account log and orphaned actors. |
| `cleanup_accounts_marked_for_deletion_in_fls` | in_account_ids text[] → void | — | Cleanup accounts marked for deletion in fls. |
| `delete_account` | in_user_id text, in_reason text → boolean | `db.go:702` | Hard-delete an account by FLS id; returns bool. |
| `get_character_transfer_related_items` | in_fls_id text → jsonb | — | Get character transfer related items. |
| `get_unsaved_base_totem_ids_for_account` | in_account_id bigint → TABLE(totem_id bigint) | — | Bases not yet backed up (pre-transfer check). |
| `migrate_character` | in_account_id bigint, home_dimension integer, max_solaris_allowed bigint → void | — | Cross-server character migration; clamps Solaris to allowed cap. |
| `migrate_clamp_max_allow_solaris` | in_pawn_id bigint, max_solaris_allowed bigint → void | — | Clamp currency on migration. |
| `remove_character_transfer_state` | in_fls_id text → void | — | Remove character transfer state. |

### travel

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `load_travel_return_info` | in_player_controller_id bigint → TABLE(map text, transform dune.transform) | — | Load travel return info. |
| `load_travel_to_player_info` | in_player_controller_id bigint → TABLE(map text, transform dune.transform, partition_id bigint, dimension_index integer) | — | Load travel to player info. |
| `save_travel_return_info` | in_player_controller_id bigint, in_map text, in_transform dune.transform → void | — | Save travel return info. |

### vehicle

| Routine | Args → Returns | Used by | Purpose |
|---|---|---|---|
| `_character_transfer_ensure_player_is_owner_of_vbt_vehicle` | in_vehicle_id bigint[] → void | — | Character transfer ensure player is owner of vbt vehicle. |
| `_character_transfer_store_in_world_owned_vehicles_into_recovery` | in_player_id bigint → void | — | Character transfer store in world owned vehicles into recovery. |
| `get_player_owned_vehicles_data` | in_player_id bigint, in_account_id bigint → TABLE(out_actor_id bigint, out_name text, out_class text, out_map text, out_partition_id bigint, out_dimension integer, out_transform dune.transform, out_actor_state text) | — | Get player owned vehicles data. |
| `get_unbacked_up_vehicle_ids_for_account` | in_account_id bigint → TABLE(vehicle_id bigint) | — | Vehicles not yet backed up (pre-transfer check). |
| `get_vehicle_id` | in_actor_id bigint, in_class text → bigint | — | Get vehicle id. |
| `get_vehicle_module_inventory_id` | in_vehicle_module_id bigint, in_vehicle_module_inventory_type integer → bigint | — | Get vehicle module inventory id. |
| `load_backup_vehicle` | in_account_id bigint → TABLE(out_id bigint, out_class text, out_customization_id text) | — | Read backed-up vehicle metadata for an account. |
| `load_recovered_vehicles` | in_account_id bigint, in_restore_time_limit integer → TABLE(out_vehicle_id bigint, out_class text, out_name text, out_time_stored timestamp without time zone, out_chassis_durability real, out_customization_id text, out_migrated boolean) | — | List recoverable vehicles for an account. |
| `load_vehicle_modules` | in_vehicle_id bigint → TABLE(module_id bigint, template_id text, stats jsonb) | — | Load vehicle modules. |
| `restore_backup_vehicle` | in_account_id bigint, in_server_info dune.serverinfo, in_transform dune.transform → bigint | — | Spawn a backed-up vehicle for an account; returns vehicle id. |
| `restore_recovered_vehicle` | in_account_id bigint, in_vehicle_id bigint, in_server_info dune.serverinfo, in_transform dune.transform, in_restore_time_limit integer → void | — | Recover a vehicle into world; supports a time limit. |
| `save_vehicle_modules` | in_add_list dune.vehiclemodule[], in_delete_list bigint[], in_stat_update dune.itemstatupdate[] → SETOF bigint | — | Save vehicle modules. |
| `store_backup_vehicle` | in_vehicle_id bigint, in_account_id bigint, in_customization_id text → void | — | Move a vehicle into the backup slot. |
| `store_recovered_vehicle` | in_vehicle_id bigint, in_chassis_durability real, in_customization_id text, in_is_migration boolean → void | — | Save a recovered vehicle (with chassis durability/customization). |
| `store_recovered_vehicles_wiped_before_spawn` | in_vehicle_ids bigint[], in_delete_items boolean → void | — | Bulk: save recovered vehicles, optionally delete their items. |

## Cross-reference summary — what dune-admin already uses

| Routine | Called at |
|---|---|
| `adjust_player_virtual_currency_balance` | `db.go:475`<br>`db.go:519` |
| `admin_move_offline_player_to_partition` | `db.go:3341` |
| `change_player_faction` | `db.go:2239` |
| `character_transfer_export` | `handlers_players.go:522` |
| `complete_journey_story_nodes_for_player` | `db.go:2229` |
| `delete_account` | `db.go:702` |
| `delete_all_journey_story_nodes` | `db.go:1955` |
| `delete_all_tutorial_entries` | `db.go:2287` |
| `delete_item` | `db.go:718` |
| `delete_mnemonic_recall_lesson_all` | `db.go:2304` |
| `get_solaris_id` | `db.go:477`<br>`db.go:487`<br>`db.go:927` |
| `reset_specialization_keystones` | `db.go:740` |
| `reset_specialization_tracks` | `db.go:737` |
| `set_character_name` | `db.go:577` |
| `set_player_faction_reputation` | `db.go:995`<br>`db.go:1083`<br>`db.go:1497`<br>`db.go:2254` |
| `set_specialization_xp_and_level` | `db.go:2936` |
| `update_player_tags` | `db.go:628`<br>`db.go:1458`<br>`db.go:1938`<br>`db.go:1966`<br>`db.go:2245` |
| `update_returning_player_status` | `db.go:665` |

## Proposed additions and fixes to dune-admin

Concrete, high-confidence gaps where the DB already provides the right primitive but the admin tool either rolls its own SQL or has no UI for it. Each item is independently shippable.

### Vehicle backup / recovery UI

Admin has zero coverage of vehicle backup/recovery. Add a `handlers_vehicles.go` mirroring the base backup pattern. The DB primitives lock `backup_vehicles` exclusively so concurrent-safe; admin just needs the UI + RPC wiring.

Routines:

- `dune.store_backup_vehicle(in_vehicle_id bigint, in_account_id bigint, in_customization_id text)` — Move a vehicle into the backup slot.
- `dune.restore_backup_vehicle(in_account_id bigint, in_server_info dune.serverinfo, in_transform dune.transform)` — Spawn a backed-up vehicle for an account; returns vehicle id.
- `dune.load_backup_vehicle(in_account_id bigint)` — Read backed-up vehicle metadata for an account.
- `dune.store_recovered_vehicle(in_vehicle_id bigint, in_chassis_durability real, in_customization_id text, in_is_migration boolean)` — Save a recovered vehicle (with chassis durability/customization).
- `dune.store_recovered_vehicles_wiped_before_spawn(in_vehicle_ids bigint[], in_delete_items boolean)` — Bulk: save recovered vehicles, optionally delete their items.
- `dune.restore_recovered_vehicle(in_account_id bigint, in_vehicle_id bigint, in_server_info dune.serverinfo, in_transform dune.transform, in_restore_time_limit integer)` — Recover a vehicle into world; supports a time limit.
- `dune.load_recovered_vehicles(in_account_id bigint, in_restore_time_limit integer)` — List recoverable vehicles for an account.

### Character-transfer pre-flight checks

`handlers_players.go:522` calls `character_transfer_export` directly. The v1.40.1 safety helpers above exist specifically to gate this. Call `character_transfer_get_unsaved_counts(fls_id)` before export and either refuse or surface a confirmation listing the unsaved totem and vehicle IDs.

Routines:

- `dune.character_transfer_get_unsaved_counts(in_fls_id text)` — Pre-transfer counts of unsaved bases/vehicles.
- `dune.get_unsaved_base_totem_ids_for_account(in_account_id bigint)` — Bases not yet backed up (pre-transfer check).
- `dune.get_unbacked_up_vehicle_ids_for_account(in_account_id bigint)` — Vehicles not yet backed up (pre-transfer check).

### Base backup / restore UI

`handlers_bases.go` currently walks raw actor/building tables. Wrap the dedicated procs above for save / list / restore / delete / recycle so behavior matches the in-game flow (and audit trail).

Routines:

- `dune.base_backup_save_from_totem(in_player_id bigint, totem_id bigint)` — Snapshot a single base keyed by totem id; returns backup id.
- `dune.base_backup_save_all_totems_from_player_owner(in_player_id bigint)` — Snapshot every base a player owns; returns set of backup ids.
- `dune.base_backup_find_totems_from_player_owner(in_player_id bigint)` — List totem ids owned by a player (read-only).
- `dune.base_backup_get_available_backups(in_player_id bigint)` — List stored backups for a player.
- `dune.base_backup_get_data(in_base_backup_id bigint)` — Read backup metadata.
- `dune.base_backup_get_buildable_data(in_base_backup_id bigint)` — Read buildable-piece data for a backup.
- `dune.base_backup_delete(in_base_backup_id bigint)` — Delete a stored base backup.
- `dune.base_backup_recycle(in_base_backup_id bigint, in_target_inventory_id bigint)` — Recycle a stored base backup into an inventory.
- `dune.base_backup_finish_placing(in_base_backup_id bigint)` — Finalize placement of a restored backup.
- `dune.base_backup_get_actors_to_spawn(in_base_backup_id bigint)` — Read actors to spawn for backup placement.

### Use admin_get_character_ids for player search

Replaces hand-rolled `LIKE` queries with the indexed admin function so dune-admin agrees with other internal tools on what counts as a match.

Routines:

- `dune.admin_get_character_ids(in_search_term text)` — Admin player search by partial name/id.

### Replace raw returning-player UPDATE with procs

Currently the admin issues raw `UPDATE encrypted_player_state SET last_returning_player_*` (see memory note about the "sticky welcome-back modal" footgun). Route through these two functions to keep the timestamp pair coherent with the login flow.

Routines:

- `dune.update_returning_player_status(in_user_id text, in_minimum_returning_player_time_seconds integer)` — Recalculate returning-player eligibility on login.
- `dune.returning_player_award_given(in_account_id bigint)` — Stamp last_returning_player_awarded_time = now() for an account.

### Keystone purchases via purchase_specialization_keystone

Admin grants keystones with raw inserts; the proc returns bool after running game-side validation. Route through it so granting from dune-admin behaves identically to in-game purchase.

Routines:

- `dune.purchase_specialization_keystone(in_player_id bigint, in_keystone text)` — Validate-then-record a keystone purchase. Returns bool.

### Bulk inventory edits via update_inventory

Replace N-round-trip CRUD with the single bulk mutator. Reduces lock churn and matches the game-side write pattern.

Routines:

- `dune.update_inventory(in_delete_list bigint[], in_stack_update dune.itemstackupdate[], in_quality_update dune.itemqualityupdate[], in_stat_update dune.itemstatupdate[], in_item_locations dune.inventoryitemlocation[])` — Bulk inventory mutator (delete, stack, quality, stats, location lists).
- `dune.update_inventories_data(in_inventory_data_list dune.inventorydata[])` — Update inventory metadata for a list.
- `dune.merge_or_move_inventory_item(in_item_id bigint, in_dst_inventory_id bigint, in_dst_index bigint, in_count bigint)` — Merge if possible, otherwise move.

### Anti-cheat surfacing

No admin UI for marking a flagged player or browsing the cheat log. Add a read view over `log_cheating` results and an admin-action to flag.

Routines:

- `dune.flag_player_as_cheater(in_account_id bigint, in_cheat_type dune.cheat_type_enum)` — Mark account as a cheater of given type.
- `dune.log_cheating(in_fls_id text, in_cheat_type dune.cheat_type_enum, in_event_time timestamp with time zone)` — Append cheating event.
- `dune.verify_item_dup_backup_tool(in_account_id bigint, in_vehicle_id bigint, in_cheat_type dune.cheat_type_enum)` — Anti-dup check around backup tool flow.

### Account takeover / deletion lifecycle

The takeover and deletion-cleanup helpers are not exposed. Worth a dedicated admin screen, especially `cleanup_accounts_marked_for_deletion_in_fls` for periodic operator maintenance.

Routines:

- `dune.can_takeover_account(in_user_id text)` — Can takeover account.
- `dune.set_account_as_takeoverable(in_user_id text, in_new_user_id text)` — Set account as takeoverable.
- `dune.load_takeoverable_user_ids()` — Load takeoverable user ids.
- `dune.takeover_account(in_user_to_takeover text, in_current_user text)` — Takeover account.
- `dune.cleanup_account_log_and_orphaned_actors()` — Cleanup account log and orphaned actors.
- `dune.cleanup_accounts_marked_for_deletion_in_fls(in_account_ids text[])` — Cleanup accounts marked for deletion in fls.

### Schema/version visibility

Surface the schema version in the dune-admin status bar so operators know which DB rev they're looking at without exec-ing into the pod.

Routines:

- `dune.get_applied_patches()` — Get applied patches.
- `dune.get_schema_version()` — Get schema version.

### Spice field operator controls

Spice-field manipulation is a known operator chore; the DB exposes prime/restart/spawn primitives that an admin "spice fields" tab could wrap.

Routines:

- `dune.try_prime_spicefield(in_source_server_id text, in_spicefield_id integer)` — Try prime spicefield.
- `dune.try_restart_spicefield(in_server_id text, in_spicefield_type_id integer)` — Try restart spicefield.
- `dune.try_spawn_spicefield(in_source_server_id text, in_spicefield_id integer)` — Try spawn spicefield.
- `dune.request_spawn_spice_field(in_server_id text, in_spicefield_type_id integer)` — Request spawn spice field.
- `dune.record_deactivated_spice_field(in_server_id text, in_spicefield_type_id integer)` — Record deactivated spice field.
- `dune.update_spice_field_spawn_state(in_is_spawning_active boolean, in_spicefield_type_id integer)` — Update spice field spawn state.
- `dune.update_global_spice_field_rules(in_max_globally_primed integer, in_max_globally_active integer, in_spicefield_type_id integer)` — Update global spice field rules.

### Landsraad voting / decree management

Five Landsraad PROCEDUREs (insert tasks, nominate decrees, update decrees, update factions, create_event_log_partition_table). The 35 functions are mostly read-side. An admin tab that shows the current term and lets ops force-advance/update decrees would be high-value during live ops.

Routines:

- `dune.landsraad_insert_tasks(IN in_term_id bigint, IN in_tasks dune.landsraadtask[], IN in_task_rewards dune.landsraadtaskreward[])` — Landsraad insert tasks.
- `dune.landsraad_nominate_decrees_for_voting(IN last_active_decree_id bigint, IN num_decrees integer)` — Landsraad nominate decrees for voting.
- `dune.landsraad_update_decrees(IN in_decrees dune.landsraaddecree[])` — Landsraad update decrees.
- `dune.landsraad_update_factions(IN in_faction_names text[])` — Landsraad update factions.

## Notes & caveats

- Purpose blurbs come from three sources, in order: curated descriptions for the well-known ~60 routines; the Postgres COMMENT (`obj_description(oid)`) when present; otherwise a name-derived stub. The DB had almost no COMMENTs set, so most stubs are name-derived.
- The categorizer is rule-based on routine name. Edge cases land in `misc`; if you add an obvious cluster, edit `RULES` in `_export.sh` and re-run.
- Overloaded routines (same name, different signatures) get separate files; if two share an arg count the OID is appended.
- The Go cross-reference is a literal regex search for `dune.<name>(` in `*.go` files at the repo root. False negatives possible if a query is built with computed names; spot-check the routine you care about by hand.
