Docs

postgres/append.sql

append.sql — insert-only load, skip rows already present (idempotency)

append.sql — insert-only load, skip rows already present (idempotency)

Context fields  

  • .HistorySchema
  • .HistoryTable
  • .StagingSchema
  • .StagingTable

Template  

{{- /* append.sql — insert-only load, skip rows already present (idempotency) */ -}}
{{- /* Also used for dedup_append — semantic distinction is at the agent context level */ -}}
{{- /* Uses ON CONFLICT with the universal UNIQUE(hpk, valid_to) index (ADR-008). */ -}}
INSERT INTO "{{ .HistorySchema }}"."{{ .HistoryTable }}" (
    {{ template "business_col_list" . }}, {{ template "amf_system_cols" . }}
)
SELECT {{ template "business_col_list" . }}, {{ template "amf_system_vals" . }}
FROM   "{{ .StagingSchema }}"."{{ .StagingTable }}" stg
ON CONFLICT (amf_hash_primary_key, amf_valid_to) DO NOTHING

Provenance  

Platformpostgres
Filepostgres/append.sql
Versionv1.3.1
Lines9
SHA-2561a363aff8b71a404d5ad1d2728070e163de3034196aa2aa4c2141b9449dcecf0

Last updated on October 11, 2026