Stream records through CopyBulkLoader.Cursor in loadRecords and reuse writeRecord, eliminating duplicate decompression, line skipping, record reading, heap tracking and blank line filtering.
Verify Cursor record iteration, line tracking and raw byte capture, along with writeRecord chunking across PostgreSQL CopyData wire frames.
A job failure (SQLState 42xx or 0A000) cannot clear on its own, so re-marking the bucket made every sweep reconnect and log a WARN. The job now waits for the next upload. The predicate is shared with CopyJobRunner via S3TransferException.isJobFailure.
A prepared statement with a predicate on a bound value (WHERE day = $1) loaded every Glue partition, because the pruner read only literals. The Bind message now carries its text-format values, and the pruner reads each $n as the value bound to it.
A statement that is only being parsed has no values yet, so it loads no partition, enough for PostgreSQL to plan it; each Bind loads the partitions its values select. A NULL, binary-format or unreadable value leaves its predicate out and the query loads every partition. A malformed Bind parameter section leaves the values unknown instead of failing the connection.
Parse of a parameterized Spectrum statement no longer deletes partitions by cast key,
which could remove rows of overlapping partitions that stay recorded as loaded; the
Bind reconciles the table. Bind parameters are decoded only when a Spectrum statement
needs them, and binary values are skipped instead of copied.
Stage partitions loaded by a load that may roll back per client connection and publish them when the transaction commits, guarded by a per-table generation, instead of loading every partition.
ensurePartitions waited on the per-table Java lock without a timeout even when the session held PostgreSQL locks. A transaction holding a table lock while another connection held the Java lock to load that table formed a cycle PostgreSQL cannot detect. It now uses the same transaction-aware acquisition as the full-load path.
Pruning also applies to the Data API outside a transaction block, a predicate on a bind parameter is left out while literal predicates in the same statement still prune, and a session in a transaction block now waits at most 30 seconds for another load of the same table.
* feat(redshift): support COMPUPDATE, STATUPDATE, and TRIMBLANKS in COPY (#7751)
* fix(redshift): keep NULL markers and empty strings correct under COPY TRIMBLANKS (#7751)
Skip trimming for a field that is the NULL marker, and quote a CSV field that trims to an empty string so it is not read as NULL.
* fix(redshift): accept COMPUPDATE PRESET and trim trailing tabs under TRIMBLANKS (#7751)
* feat(redshift): support CopyClusterSnapshot API action (#7748)
* fix(redshift): address review findings and sync docs for CopyClusterSnapshot (#7748)
* refactor(redshift): simplify CopyClusterSnapshot using existing helpers (#7748)
Drop Tags, KmsKeyId and the ARN branch, which CopyClusterSnapshotMessage does not carry.
Reuse validateManualRetention (InvalidRetentionPeriodFault), takenFrom and SnapshotDumpCopier.copy,
and share the automated-snapshot setup across the new tests.
CreateIntegration accepts arn:aws:s3:::bucket with a Serverless namespace or cluster target. The bucket must exist in the integration's Region and have no period in its name, a bucket joins a target once, and a target takes at most 50. The integration reports SourceType s3-event-notifications, starts no poller and publishes no zero-ETL events.
fix(redshift): validate S3 integration source and target identities
fix(redshift): resolve unstored S3 bucket Region in default Region
Fall back to the deployment default Region when an S3 bucket has no stored Region, match bucket partition using RegionResolver.partitionForRegion, and remove the unused two-argument RedshiftZeroEtlEndpoints constructor.
A job stores the parameters of a COPY from S3 in the cluster database, and sys_copy_job lists it with AWS's columns. The checks AWS documents are made when the job is created: an S3 source, an explicit IAM_ROLE, no manifest, access keys, MAXERROR or IGNOREALLERRORS, no hyphen in the name, no transaction block, at most 200 jobs. COPY JOB RUN is refused until files can be loaded automatically.
* feat(redshift): prune external table partitions from query WHERE predicates
Load only the partitions selected by top-level AND predicates of the query WHERE clause for external tables, accumulating partitions across queries and avoiding full scans when specific partitions are requested.
* fix(redshift): handle CASE in partition pruner, overlapping refreshes, and isolate spectrum test schema
* fix(redshift): identify materialized rows by partition and share SQL lexer
Tell materialized external table rows apart by an internal partition identifier column so that refreshing or deleting a partition only deletes its exact rows and never removes rows belonging to partitions whose keys overlap when converted. Dropping a partition no longer reads or authorizes retained overlapping partitions, preventing unauthorized S3 access errors on unselected partitions.
Share tokenization rules between ExternalReferenceScanner and PartitionPruner in SpectrumSqlLexer.
* fix(redshift): hide the partition column behind a view and read strings as strings in the scanner
A partitioned external table kept the partition each row came from in a column of the public table,
so SELECT * returned an extra column and INSERT ... SELECT * could fail on the column count. The rows
now live in a backing table, _floci_spectrum_<table>, and the name the user queries is a view of the
declared columns only. DROP TABLE drops the view and the backing table, and the Data API ListTables
does not list the backing table.
ExternalReferenceScanner took a one-character string such as ';' for a statement separator, which
cleared the table context and let the query skip preparation and its S3 checks. It now reads the
structural characters by token kind.
The pruning integration test used the legacy catalog, whose parser does not read PARTITIONED BY, so
it now creates a Glue database.
* fix(redshift): keep the partition backing table in a schema of its own and send plain batches
The batches that drop and replace the relation of a partitioned external table started with a DO
block. PostgresExtendedBackendSession wraps only batches that start with CREATE or DROP, so an
extended query sent them unchanged and PostgreSQL refused several commands in one prepared
statement. A DO block nested in the wrapper is not valid either, and a schema or table name that
held the dollar-quote tag would have closed the body early. The relation is now dropped with
DROP VIEW or DROP TABLE as the last load made it, so every batch is plain statements.
The backing table was named after the table it backs in the user's schema, so a Glue table of the
same name could drop or reuse it, and the Data API ListTables hid every table with that prefix. It
now lives in the schema floci_spectrum under a name made from the external schema and table, and
ListSchemas and ListTables hide only that schema.
* fix(redshift): load the whole external table when partition keys overlap instead of keeping a backing table
Delete by key value is only safe when no two partitions cast to the same value. When they do (integer 1 and 01, decimal 1.0 and 1.00, boolean true and t), the query reads every partition and a change replaces the whole table. This drops the backing table, view and floci_spectrum schema, which broke dropping a table whose Glue definition gained partition keys, other users' loads, and DROP SCHEMA CASCADE.
* fix(redshift): expect 22P02 SQLSTATE on invalid partition data
* feat(redshift): add PutResourcePolicy, GetResourcePolicy and DeleteResourcePolicy
aws_redshift_resource_policy could not be created: the provisioned Redshift API had none of the three operations. They now take the ARN of a Redshift Serverless namespace or a provisioned cluster, the targets of a zero-ETL integration, matched exactly in the caller's account and Region. The policy is kept on its namespace or cluster, so it goes with the resource, and is stored and echoed, not evaluated.
* feat(redshift): return resource policies and their errors as AWS does
Checked against AWS with read-only GetResourcePolicy calls: a stored policy comes back with Version and
Statement first and each statement's Effect, Principal, Action, Resource and Condition first,
pretty-printed, so it is now stored in that form. A namespace that does not exist answers "The requested
namespace doesn't exist."; an ARN in another Region, a namespace id that is not a UUID and an ARN of any
other resource type are InvalidParameterValue with AWS's messages, not UnsupportedOperation.
Adds an SDK compatibility test for the three operations.
* fix(redshift): keep a namespace's resource policy across updates
The Namespace copy constructor, used by tagging, untagging and UpdateNamespace, did not copy the
resource policy, so any of them dropped it. findClusterByArn now reads the ARN through AwsArnUtils.
Without a Version, GetResourcePolicy reached Elastic Load Balancing, which defines the name but does
not serve it; it now goes to Redshift.
* fix(redshift): refuse an empty resource policy before looking the resource up
* feat(redshift): take a DynamoDB table and a Serverless namespace in zero-ETL integrations
CreateIntegration took only a DynamoDB stream ARN as SourceArn and a provisioned cluster ARN as
TargetArn. AWS takes the table ARN and a Redshift Serverless namespace ARN (its model allows no
cluster: ARN), so a Terraform aws_redshift_integration written for AWS failed to create.
Both AWS forms are now accepted and the original ones are kept. A missing table is
IntegrationSourceNotFoundFault and a missing namespace IntegrationTargetNotFoundFault, as the API
reference lists. A namespace is written through its workgroup into the namespace's database. A
table source reads changes from the table's latest stream, following one turned on after the
integration was created.
Stream records never landed: the writer bound ApproximateCreationDateTime as an Instant, which the
PostgreSQL driver refuses, so only backfilled items reached the landing table. It now binds an
OffsetDateTime as TIMESTAMPTZ.
* fix(redshift): drain a table's replaced stream and match the source table ARN
A table source moved to the table's latest stream as soon as it changed, dropping records the old
stream still held, and moved to no stream when DynamoDB Local reported none for a table whose streams
were turned off. It now reads the followed stream until a read comes back empty, or until the stream
has expired, before moving, keeps it while the table reports no stream, and persists the move.
A source table ARN was resolved by its table name alone, so a table of another account, or an ARN
with more after the name, was taken for the caller's table of that name. The resolved table must now
have the supplied ARN. The docs no longer promise IntegrationSourceNotFoundFault for a missing stream.
* test(redshift): use the shared Docker probe and Query request helpers in the zero-ETL test
* feat(redshift): support MAXERROR in COPY
MAXERROR n of 2 or more now asks the backend to skip records it cannot convert
(ON_ERROR ignore) and to fail the COPY at the n-th one (REJECT_LIMIT n - 1),
which needs a PostgreSQL 18 backend. A MAXERROR of 0 or 1 fails at the first
error, as without the option.
* test(redshift): add PostgreSQL 18 MAXERROR integration test
* test(redshift): use shared DockerAvailability and RedshiftConnections in PostgreSQL 18 IT
Address review feedback on PR #7291:
- Call testing.DockerAvailability.isAvailable() instead of carrying a private copy of the probe.
- Use RedshiftConnections.waitForConnection(cluster) instead of duplicating the JDBC connection wait helper.
* fix(redshift): keep tags, VPC and subnet detail on cluster subnet groups
CreateClusterSubnetGroup dropped Tags and passed a null VPC, so
DescribeClusterSubnetGroups returned no Tags, VpcId, SubnetGroupStatus or
SubnetAvailabilityZone and the Terraform provider saw drift on every plan.
Tags are now parsed (Tags.member.N and Tags.Tag.N) and stored on the group,
where DescribeTags/CreateTags already find them under the subnetgroup ARN.
The VPC and each subnet's zone are resolved from EC2 on create and modify;
subnets EC2 does not know are kept unresolved, as before. Groups persisted
earlier load unchanged (the new zone map is nullable).
* fix(redshift): inject Ec2Service through the constructor
Replace the Ec2Service field injection with a constructor parameter held
in a final field. The previous @Inject signature stays as a package-private
delegating constructor passing null, so hand-built test services still
skip subnet resolution.
* test(redshift): build the EC2 setup requests with Ec2Requests
ec2Id now only extracts the id from the response; the auth header and
Action come from the shared Ec2Requests.ec2 helper.
* test(redshift): make ec2Id a plain path extraction
Call sites build the EC2 request with Ec2Requests.ec2 and pass it in;
the account and region are named constants.
* feat(redshift): support FILLRECORD in COPY
A text or CSV record that stops short of the last columns is loaded with the
rest of them filled: a character column gets a zero-length string and any other
column NULL, as in Redshift. EMPTYASNULL and NULL AS '' make the character
columns NULL too. Without FILLRECORD nothing changes.
* fix(redshift): bound memory growth for FILLRECORD output
Count transformed output against COPY_TRANSFORM_MAX_OBJECT_BYTES and the shared COPY_TRANSFORM_HEAP_MIB budget as records are written, so short records expanded by FILLRECORD fail with the statement limit or memory budget error rather than exhausting the emulator heap.
* fix(redshift): load missing CHAR columns as NULL on FILLRECORD
* feat(redshift): copy cluster snapshots into the configured destination region
EnableSnapshotCopy used to only record the destination on the cluster. A background sweep now copies each available snapshot taken after copy was enabled into a per-Region copy store, with its own dump file, retention and KMS key from the copy grant. Describe, delete, restore and tagging use the copy when the request's Region has one.
* fix(redshift): harden snapshot copy expiry, rollback and same-region enable
Expiry re-reads the copy under the lock so a replaced copy is not deleted. A failed flush undoes the copy record and the source mark before the dump is removed. A sweep re-checks that copy is still enabled to the destination. EnableSnapshotCopy refuses the cluster's own Region, and CreateClusterSnapshot refuses an identifier a copy already holds in that Region.
* fix(redshift): harden snapshot copy and share the sweep scheduler base and dump copier
Snapshot copy: keep a retained copy when a source snapshot is recreated under the same name, flush the copy before marking the source, only apply the cluster's copy retention to copies of the same cluster generation, recheck the copy settings under the snapshot lock before each copy, and leave shadowed sources out of DescribeTags.
Refactor: the five SweepWorker scheduler wrappers now extend SweepScheduler, and both services copy dumps through SnapshotDumpCopier.
* docs(redshift): note the hybrid storage limit of snapshot copy
Hybrid storage does not report a failed flush, so a crash can leave a source snapshot marked as copied without its copy. Persistent and WAL storage report the failure before the source is marked.
* feat(redshift): support event history and SNS notifications
* fix(redshift): guard stale delivery failures and prune all event scopes
* feat(cloudformation): provision Redshift event subscriptions
* fix(redshift): scope snapshot events and serialize subscription tag mutations
* feat(cloudformation): provision Redshift event subscriptions
* fix(cloudformation): resolve Redshift subscription list parameters
Use the shared list reader for SourceIds and EventCategories. Cover CommaDelimitedList and List<String> parameters through the AWS SDK and verify concurrent tag requests preserve CloudFormation tag updates.
* fix(redshift): honor event disablement and restore rollback attributes
Check the EventBridge external service key before publishing API events. Snapshot and restore CloudFormation resource attributes alongside subscription state during in-place rollback.
* fix(redshift): drop API event publisher and share subscription setup
Remove RedshiftApiEventPublisher, its handler hook, tests and docs, which are not part of the CloudFormation resource and emit CloudTrail-style events without a trail. Route createSubscription and replaceSubscription through one helper that normalizes the subscription fields.
* feat(redshift): publish CloudWatch cluster metrics
* fix(redshift): skip duplicate CloudWatch publication minutes
* test(redshift): isolate metrics publisher between integration tests
* fix(test): use Java 17 list access in Redshift metrics compatibility test
* fix(metrics): share minute publishing and prevent duplicate SQS samples
Centralize daemon scheduling, minute claims, per-target failures, retention and shutdown for SQS and Redshift. Carry the Redshift proxy key in metric targets and use the shared compatibility await fixture.
* docs(metrics): restore publisher class docs after the shared publisher move
Keep the SQS sample shape on SqsMetricsPublisher and document minute stamping, 15-day retention and the nothing-may-escape rule on MinuteMetricsPublisher.
* feat(redshift): add event subscriptions with SNS delivery
Add Create, Modify, Delete and DescribeEventSubscriptions, subscription tagging, and publication of matching events to the subscription's SNS topic, honouring the topic policy.
* fix(redshift): deliver events from a consistent subscription snapshot and reject nameless subscription ARNs
Delivery copied no state under the lock modifySubscription holds, so a concurrent
update could change the topic between matching and publishing. Match and publish
from a snapshot taken under that lock.
A tag ARN ending in eventsubscription: passed an empty name to
describeSubscriptions, which lists all subscriptions. Reject it up front.
* feat(redshift): execute automated snapshot schedules
* fix(redshift): address automated snapshot review findings
Flush snapshot metadata before deleting an expired dump, pause the
snapshot scheduler across emulator reset, run retention even when the
next dump fails, and remove checkpoints of deleted clusters.
* fix(redshift): retake an automated snapshot whose metadata was lost
The checkpoint is a separate store, so it can persist while the snapshot
metadata never reached disk. Skip a completed occurrence only when its
snapshot still exists.
* test(redshift): restore the automated snapshot on the shared interceptor cluster
Run the Docker restore scenario in RedshiftInterceptorIntegrationTest
against the cluster it already starts, so only the restore pays for a
container, and drop the hand-rolled Docker probe.
* fix(redshift): raise postgres max_connections to 500
The Postgres container behind a Redshift cluster runs with the default max_connections of 100, and each retained session keeps a connection open. Near 100 sessions, Data API calls and JDBC clients on that cluster encounter 'sorry, too many clients already', well before reaching the 500-session limit. Raising max_connections to 500 in RedshiftContainerManager lets the documented 500-session limit apply.
* fix(redshift): raise default proxy max connections to 500
The PostgreSQL backend limit was raised to 500, but the Redshift auth proxy connection semaphore defaulted to 100 via proxy-max-connections. As a result, client connections above 100 were refused by the proxy before reaching PostgreSQL. Raise the default proxy-max-connections to 500 across config, application YAML, and documentation.
* fix(redshift): follow node type for max_connections and raise proxy default to 2000
* fix(redshift): support rg node types, pass serverless from runtime, and update test stubs
- Include rg.* node types for 2,000 max_connections
- Pass 'serverless' node type from RedshiftServerlessRuntime and drop prefix check
- Update start(...) stubs across integration tests with the six-argument signature
Reclaim disposable anonymous volumes while preserving adopted containers during failed recovery. Retain pre-reboot dumps and failed cleanup ownership across partial teardown. Preserve the original database when only proxy shutdown fails. Share startup orchestration while retaining the opt-in cleanup policy.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* feat(redshift): support default IAM roles for COPY and UNLOAD
* fix(redshift): distinguish default role keyword from literals
* fix(redshift): accept blank default IAM roles
Under IAM enforcement a request that passes a role to a service needs iam:PassRole on that role,
but no Redshift or Redshift Serverless operation was checked for it. A caller allowed to create a
cluster or change its roles could attach any role to it, and Floci's COPY, UNLOAD and Spectrum
statements then run as that role; statements run through the Data API on a Redshift Serverless
workgroup can use its namespace's roles the same way.
Now checked, with iam:PassedToService as the Service Authorization Reference gives it:
- Redshift CreateCluster and RestoreFromClusterSnapshot pass the roles in IamRoles, and
ModifyClusterIamRoles those in AddIamRoles, to redshift.amazonaws.com. The lists are read through
the Redshift handler's own member pattern, so IamRoles.IamRoleArn.N, as the SDK sends it,
IamRoles.member.N and IamRoles.N all count. RestoreFromClusterSnapshot is checked although
Floci's restore attaches no role yet, as AWS checks it.
- Redshift Serverless CreateNamespace and UpdateNamespace pass the roles in iamRoles and the one
in defaultIamRoleArn, and CreateScheduledAction and UpdateScheduledAction pass roleArn, to
redshift-serverless.amazonaws.com.
The Redshift management guide: "To associate an IAM role with a cluster, a user must have
iam:PassRole permission for that IAM role." A role named only as a cluster's default,
DefaultIamRoleArn, is not checked on its own: the default is one of the roles the cluster holds, and
Floci does not act on it. A namespace's defaultIamRoleArn is checked, since Floci keeps it whether
or not iamRoles holds it.
COPY, UNLOAD and Spectrum now take a role only under the ARN IAM holds it under, path included, as
STS AssumeRole does. They looked the role up by its name alone, so a cluster given
role/sandbox/AdminRole, which a PassRole grant on role/sandbox/* allows, ran its statements as the
AdminRole IAM holds under another path.
IAM's AddRoleToInstanceProfile now passes the role it adds to ec2.amazonaws.com. Every instance
running with the profile gets that role's credentials from the instance metadata service, so adding
a role to a profile already attached to a running instance handed it any role. The IAM API
reference: "The caller of this operation must be granted the PassRole permission on the IAM role by
a permissions policy." RoleName names the role without its path, so the check uses the ARN IAM holds
the role under, or, for a role IAM does not hold, the ARN the name gives.
docs/services/iam.md lists the new operations, and docs/services/redshift.md the path rule.
* feat(firehose): deliver staged Redshift batches with single-attempt COPY
A flush stages the batch in the intermediate S3 location, then runs COPY against the cluster proxy over JDBC simple-query mode without an IAM role. The load runs on its own thread so that slow COPY queries do not hold the shared flush executor or PutRecord callers, and failures are logged with the staged batch kept in S3.
* fix(firehose): address review comments on Redshift single-attempt COPY delivery
- Drain buffers before shutting down the Redshift delivery executor on Firehose shutdown and log dropped queued tasks.
- Catch RejectedExecutionException in deliverRedshiftBatch to prevent staged records from returning to the buffer.
- Extract DatabaseSecretCredentials helper in core.common to deduplicate Secrets Manager credentials parsing across RDS Data, Redshift Data, and Firehose.
- Extract RedshiftConnections test helper for waitForConnection and use DockerAvailability.isAvailable() in FirehoseRedshiftDeliveryIntegrationTest.
- Update docs and Javadocs to remove outdated references to retries and shared flush threads.
* fix(firehose): wait for queued Redshift COPY delivery before shutdown and log secret parse errors
* refactor(firehose): deduplicate dropAndLogQueuedTasks helper on shutdown
Rebuild host-resource uploads and catalog tar streams for transient Docker I/O retries. Keep SQL outside the retry boundary and preserve snapshot failure and optional bootstrap behavior.
Refs #5096.
* feat(redshift): add snapshot copy and snapshot schedule operations
Terraform's aws_redshift_snapshot_copy, aws_redshift_snapshot_schedule and
aws_redshift_snapshot_schedule_association failed with InvalidAction because
the Query handler had no arms for these actions.
- EnableSnapshotCopy / DisableSnapshotCopy / ModifySnapshotCopyRetentionPeriod
store the copy settings on the cluster, and DescribeClusters reports
ClusterSnapshotCopyStatus while copy is enabled. RetentionPeriod defaults
to 7 and ManualSnapshotRetentionPeriod to -1. Faults follow the Redshift
model: SnapshotCopyAlreadyEnabledFault, SnapshotCopyAlreadyDisabledFault,
SnapshotCopyDisabledFault (modify), InvalidRetentionPeriodFault and
SnapshotCopyGrantNotFoundFault.
- Create/Describe/Modify/DeleteSnapshotSchedule and
ModifyClusterSnapshotSchedule. The association lives on the cluster, so
DescribeSnapshotSchedules derives AssociatedClusters (state ACTIVE) and
filters by ClusterIdentifier from it, and a deleted cluster cannot leave a
stale association. Deleting a schedule in use is refused with
InvalidClusterSnapshotScheduleState.
- Snapshot schedules take part in CreateTags/DeleteTags/DescribeTags as
resource type snapshotschedule.
No snapshot is copied to another region or taken on a schedule; the docs
say so.
* fix(redshift): reject malformed snapshot schedules and in-use copy grant deletion
* fix(redshift): validate snapshot copy region and snapshot schedule identifier
EnableSnapshotCopy now refuses a DestinationRegion that is not a published
AWS region with UnknownSnapshotCopyRegionFault (404), as the model lists.
CreateSnapshotSchedule now refuses a ScheduleIdentifier containing anything
but letters, digits and hyphens with InvalidParameterValue (400). The API
reference allows alphanumerics; the management guide's example uses a hyphen.
* 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
* feat: add relational queries for Redshift Spectrum
* fix(redshift): harden Spectrum relational query preparation
Catch RuntimeException during preparation so the client gets an ErrorResponse
instead of a dropped connection, skip preparation while the backend discards
until Sync, defer schema binding until the transaction commits, make the
catalog functions SECURITY DEFINER, and track COMMIT and ROLLBACK from the
command tag.
* fix(redshift): address review findings on transaction handling in Spectrum relational queries
- Undo Glue tables created inside a rolled back transaction (Data API batch and wire proxy)
- Keep bindings and Glue tables on ROLLBACK TO SAVEPOINT; only a closed transaction discards them
- Report the real transaction status for locally handled simple queries instead of idle
- Use a switch expression in BackendResponseCoordinator
- Map host.docker.internal into the floci-duck container on Linux
* fix(redshift): undo Glue tables across sessions and on rollback to savepoint
- Scope staged Glue tables by the backend socket so the proxy rollback finds tables created by another session
- Track SAVEPOINT, ROLLBACK TO and RELEASE so a Data API batch undoes only the tables created after the savepoint
* fix(redshift): defer Glue undo on rollback to savepoint until the backend confirms and bundle bootstrap catalog in native image
* fix(redshift): reject CREATE EXTERNAL TABLE inside a transaction like AWS
AWS does not allow CREATE EXTERNAL TABLE inside a transaction block, and a
Data API batch runs as one transaction. Return SQLSTATE 25001 instead of
staging Glue tables and undoing them on rollback, which removes the savepoint
tracking and cross-session undo code. Reuse ExternalTableMaterializer.quote.
* fix(redshift): reject CREATE EXTERNAL TABLE in a transaction for legacy schemas too
* feat(redshift): add external catalog statement parsing and metadata writers
* fix(redshift): harden external statement parsing and reference scanning
- Scanner: recognise dollar-quoted bodies, E'..\'..' strings and nested
block comments; catch SELECT INTO, CREATE VIEW and CREATE INDEX writes;
ignore FROM inside EXTRACT, SUBSTRING, TRIM and IS DISTINCT FROM.
- Parser: accept CREATE EXTERNAL SCHEMA IF NOT EXISTS, strip leading
comments, support quoted names with dots, read TBLPROPERTIES and
PARTITION values that contain parentheses or escaped quotes, validate
IAM_ROLE as one quoted literal, and canonicalise Redshift type aliases
to Hive types.
- Registry: percent-encode key parts so separators in identifiers cannot
collide.
- Backend session: do not treat socket write failures as source read
failures during COPY.
- Keep property order stable in statements.
* fix(redshift): address external catalog review findings
* fix(redshift): inherit omitted partition settings
* fix(redshift): preserve explicit empty partition settings
* fix(redshift): canonicalise character and varbyte external column types
* fix(redshift): default unsized character types
* fix(redshift): enforce Spectrum varchar default length
* fix(redshift): null surplus varchar values during Spectrum copy