The swap arm of the 12-arm transaction UNION, as a view.
Same motivation as depositTransactionView: assembled inline the union
serialises well past the 16KB statement limit RDS Proxy will parse, and a
statement over that limit pins the client session to its database connection
for the rest of the session. Behind a view the runtime statement is ~90
bytes.
The caller-supplied filters live in transaction-services/queries/swap.ts as
predicates on this view's own projected columns, because a view takes no
parameters. They are plain contract-column comparisons emitted by the shared
transactionScalarConditions, so what matters here is what each filtered
column projects:
customer_id — customer.external_id.
signature — the FIRST SOLANA_TRANSACTION_SIGNATURE element of
jsonb_array_elements(receipt). swapWorkflow pushes exactly one
SOLANA_TRANSACTION_SIGNATURE per swap, so first-match and any-match are the
same row set.
There is no bankIds filter — swaps don't touch a bank rail and this arm
always projects bank_id NULL.
Changing what those columns project silently changes the filters. The column
list must also stay identical to the sibling arms, or the UNION breaks.
securityInvoker is required, not cosmetic — every underlying table has RLS
enabled, and without it the view would run with the owner's row visibility
and silently bypass the querying role's policies.
The swap arm of the 12-arm transaction UNION, as a view.
Same motivation as
depositTransactionView: assembled inline the union serialises well past the 16KB statement limit RDS Proxy will parse, and a statement over that limit pins the client session to its database connection for the rest of the session. Behind a view the runtime statement is ~90 bytes.The caller-supplied filters live in
transaction-services/queries/swap.tsas predicates on this view's own projected columns, because a view takes no parameters. They are plain contract-column comparisons emitted by the sharedtransactionScalarConditions, so what matters here is what each filtered column projects:swapWorkflowpushes exactly one SOLANA_TRANSACTION_SIGNATURE per swap, so first-match and any-match are the same row set.There is no
bankIdsfilter — swaps don't touch a bank rail and this arm always projects bank_id NULL.Changing what those columns project silently changes the filters. The column list must also stay identical to the sibling arms, or the UNION breaks.
securityInvokeris required, not cosmetic — every underlying table has RLS enabled, and without it the view would run with the owner's row visibility and silently bypass the querying role's policies.