{
  "db_name": "PostgreSQL",
  "query": "\n            WITH locked_accounts AS (\n              SELECT 1\n              FROM cala_accounts a\n              WHERE a.id = $1\n              FOR UPDATE\n            ), locked_balances AS (\n              SELECT journal_id, account_id, currency, latest_version\n              FROM cala_current_balances\n              WHERE journal_id = $2\n              AND account_id = $1\n              FOR UPDATE\n            )\n            SELECT h.values\n            FROM cala_balance_history h\n            JOIN locked_balances b\n            ON b.journal_id = h.journal_id\n              AND b.account_id = h.account_id\n              AND b.currency = h.currency\n              AND b.latest_version = h.version\n        ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "values",
        "type_info": "Jsonb"
      }
    ],
    "parameters": {
      "Left": [
        "Uuid",
        "Uuid"
      ]
    },
    "nullable": [
      false
    ]
  },
  "hash": "2fd253fbcdef29444ee92ddfb83b683342171a890712c78915cc36f10ba0c0ae"
}
