Files
floci/docs
Vũ Thế Huy 38ce99ba54 feat(redshift): support more COPY and UNLOAD options (#5204)
* feat(redshift): support more COPY and UNLOAD options

COPY now accepts REGION, CREDENTIALS, key-based credentials, EMPTYASNULL,
BLANKSASNULL, REMOVEQUOTES, ACCEPTINVCHARS and TRUNCATECOLUMNS. UNLOAD now
accepts REGION, CREDENTIALS, key-based credentials and EXTENSION. Field
content options run in a new CopyRecordTransformer; TRUNCATECOLUMNS reads
column lengths from the catalog and so needs the Simple Query protocol.
Clauses that cannot be honoured still fail open to PostgreSQL.

* feat(redshift): support UNLOAD ESCAPE, CLEANPATH and server-side encryption options

UNLOAD now accepts ESCAPE (text framing only), CLEANPATH, ENCRYPTED AUTO and
ENCRYPTED with KMS_KEY_ID, which is stored as aws:kms server-side encryption
on the data and manifest objects. CLEANPATH lists and authorizes every delete
up front but removes the objects only when the first output arrives, so a
query that PostgreSQL rejects keeps the previous export. An empty prefix,
ALLOWOVERWRITE and client-side encryption still fail open to PostgreSQL.

* fix(redshift): address review findings on COPY and UNLOAD options

- Reject blank access key, secret, session token and IAM role so an empty
  pair cannot enable unsigned S3 access.
- CLEANPATH lists and authorizes the prefix again when the first output
  arrives, so an object uploaded since preparation does not survive.
- REMOVEQUOTES no longer closes a text-mode field on an escaped quote.
- TRUNCATECOLUMNS counts characters, as PostgreSQL does for varchar(n),
  and cuts decoded text so escape sequences are never split.
- Bound the heap used by field-level COPY options with a per-object size
  limit and a budget shared across connections.

* fix(redshift): delete the CLEANPATH prefix under one bucket lock

S3Service.deleteObjectsWithPrefix lists the prefix, authorizes every key
and deletes them while holding the bucket monitor that PutObject and
DeleteObject already use, so an upload cannot land between the listing
and the deletes and survive next to the new export.

* fix(redshift): measure TRUNCATECOLUMNS in bytes and tighten review follow-ups

Redshift counts CHAR(n) and VARCHAR(n) in bytes, so TRUNCATECOLUMNS now
measures decoded bytes and cuts on a character boundary instead of
counting characters. The UNLOAD docs described bare ENCRYPTED as
client-side; client-side is the MASTER_SYMMETRIC_KEY form. The
concurrent-put lock test now waits for the put thread to be BLOCKED
instead of a fixed 300 ms timeout.

* style(redshift): fix import order in S3CopySimulatorTest
2026-10-08 23:19:40 -04:00
..
2026-03-15 17:43:56 -05:00