{
  "db_name": "PostgreSQL",
  "query": "\n      WITH inputs AS (\n        SELECT *\n        FROM UNNEST(\n          $1::jsonb[], \n          $2::text[], \n          $3::uuid[], \n          $4::uuid[], \n          $5::uuid[], \n          $6::uuid[]\n        )\n        AS v(partition_window, currency, journal_id, account_id, velocity_control_id, velocity_limit_id)\n      )\n      SELECT \n          i.partition_window as \"partition_window!: serde_json::Value\", \n          i.currency as \"currency!\", \n          i.journal_id as \"journal_id!: JournalId\", \n          i.account_id as \"account_id!: AccountId\", \n          i.velocity_control_id as \"velocity_control_id!: VelocityControlId\", \n          i.velocity_limit_id as \"velocity_limit_id!: VelocityLimitId\",\n          h.values as \"values?: serde_json::Value\"\n      FROM inputs i\n      LEFT JOIN cala_velocity_current_balances b\n        ON i.partition_window = b.partition_window\n        AND i.currency = b.currency\n        AND i.journal_id = b.journal_id\n        AND i.account_id = b.account_id\n        AND i.velocity_control_id = b.velocity_control_id\n        AND i.velocity_limit_id = b.velocity_limit_id\n      LEFT JOIN cala_velocity_balance_history h\n        ON b.partition_window = h.partition_window\n        AND b.currency = h.currency\n        AND b.journal_id = h.journal_id\n        AND b.account_id = h.account_id\n        AND b.velocity_control_id = h.velocity_control_id\n        AND b.velocity_limit_id = h.velocity_limit_id\n        AND b.latest_version = h.version\n      ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "partition_window!: serde_json::Value",
        "type_info": "Jsonb"
      },
      {
        "ordinal": 1,
        "name": "currency!",
        "type_info": "Text"
      },
      {
        "ordinal": 2,
        "name": "journal_id!: JournalId",
        "type_info": "Uuid"
      },
      {
        "ordinal": 3,
        "name": "account_id!: AccountId",
        "type_info": "Uuid"
      },
      {
        "ordinal": 4,
        "name": "velocity_control_id!: VelocityControlId",
        "type_info": "Uuid"
      },
      {
        "ordinal": 5,
        "name": "velocity_limit_id!: VelocityLimitId",
        "type_info": "Uuid"
      },
      {
        "ordinal": 6,
        "name": "values?: serde_json::Value",
        "type_info": "Jsonb"
      }
    ],
    "parameters": {
      "Left": [
        "JsonbArray",
        "TextArray",
        "UuidArray",
        "UuidArray",
        "UuidArray",
        "UuidArray"
      ]
    },
    "nullable": [
      null,
      null,
      null,
      null,
      null,
      null,
      true
    ]
  },
  "hash": "05e1c6bd7a56ac14abcd4181a64e1e227c7f2af88bd2388820aa30f6372d80c5"
}
