pgs3 reference
Complete lookup for pgs3 v0.1.2: server GUCs, S3 API compatibility subset, SQL functions, and SQLSTATE-to-S3 error mappings.
Server configuration (GUCs)
All nine pgs3.* parameters have SIGHUP context, though some changes only take effect for new requests or require a restart as noted below.
pgs3.enabled, ,- Register the static launcher on server startup when
pgs3is inshared_preload_libraries. Dynamicpgs3.start()ignores this flag. pgs3.workers, ,- Desired number of HTTP background workers. Each consumes one
max_worker_processesslot. pgs3.listen_addr, ,- IPv4 or IPv6 bind address for HTTP workers. Keep on loopback and terminate TLS in a reverse proxy.
pgs3.inline_threshold, ,- Largest physical blob stored inline in
pgs3.blobfor new writes. Direct single-transaction PUT has an additional 64 KiB cap. pgs3.chunk_size, ,- Chunk size for staged uploads exceeding the inline threshold; snapshotted per upload on admission.
pgs3.statement_timeout_ms, ,- PostgreSQL statement/lock timeout for each SPI semantic transaction. Applies to new transactions.
Inspect live values
Reload vs. restart
- Applies on
SIGHUPreload:pgs3.workers,pgs3.listen_addr,pgs3.port,pgs3.statement_timeout_ms,pgs3.inline_threshold(new blobs), andpgs3.chunk_size(new uploads). Existing blobs keep their original physical layout. Always verify a real signed request after a port/address rebind because a failed bind can keep the old listener running. - Requires a server restart: Adding
pgs3toshared_preload_libraries, changingpgs3.enabledfromofftoonwhen the static launcher was not registered at boot, or changingpgs3.target_database. - Service role changes: Reconciling a changed
pgs3.server_roleon reload requires matching grants and lacks release acceptance testing; prefer a planned restart.
Fixed implementation thresholds
These limits are built into v0.1.2 and have no registered GUC:
- Upload lease: 5 minutes; body-idle timeout: 60 seconds (renewed on subsequent body progress).
- Pending upload retention: 24 hours; GC interval: every 60 seconds, up to 1,000 rows per batch.
- SQL hash fallback limit: Optional
pgs3.sql_hash_fallback_limitcustom setting defaults to134217728bytes (128 MiB); packaged builds use Rust hash helpers instead.
S3 API compatibility
| Area | Supported APIs | Behavior and boundaries |
|---|---|---|
| Buckets | ListBuckets, CreateBucket, DeleteBucket, HeadBucket, GetBucketLocation, GetBucketVersioning | Versioning is permanently Enabled. DeleteBucket requires an empty bucket (including historical versions); pending uploads alone are aborted atomically on delete. |
| Objects | PutObject, GetObject, HeadObject, CopyObject, DeleteObject, DeleteObjects | Supports single Range, If-Match/If-None-Match/date conditions, x-amz-meta-* metadata, source versionId copies, and SHA-256 / MD5 / flexible checksums. DeleteObjects accepts up to 1,000 keys per batch. |
| Listing | ListObjects (V1), ListObjectsV2, ListObjectVersions | Prefix, delimiter, encoding-type=url, max-keys (0–1000), V1 markers, and V2 continuation tokens. |
| Multipart | CreateMultipartUpload, UploadPart, ListParts, CompleteMultipartUpload, AbortMultipartUpload | Non-final parts must be ≥ 5 MiB. UploadPartCopy and ListMultipartUploads are not supported. |
| Version restore | POST /{bucket}/{key}?restore&versionId={id} | pgs3 extension route that publishes an older version as the new latest version (not AWS Glacier archival restore). |
Signing and unsupported features
- Supported auth: Header-based AWS SigV4 (
FullHash,UNSIGNED-PAYLOAD,STREAMING-AWS4-HMAC-SHA256-PAYLOAD,STREAMING-UNSIGNED-PAYLOAD-TRAILER) and query-parameter presigned GET/PUT URLs (max expiry 7 days, clock skew ±15 minutes). - Outside the subset: Virtual-host bucket addressing, TLS termination, bucket policies, ACLs, CORS, object tagging, lifecycle/TTL rules, object lock/retention, multi-range GET,
UploadPartCopy, andListMultipartUploads.
SQL API
Tenant operations run under the caller’s PostgreSQL role (with RLS isolation); operator functions are revoked from PUBLIC.
Buckets and objects
pgs3.create_bucket(p_name text, p_config jsonb), ,- Create a bucket owned by the current role (idempotent for the same owner).
pgs3.put(p_bucket text, p_key text, p_body bytea, p_content_type text, p_meta jsonb, p_if_none_match text, p_if_match text, p_checksum_sha256 bytea), ,- Atomically write a new object version; supports ETag preconditions and SHA-256 verification.
pgs3.head(p_bucket text, p_key text, p_version_id bigint, p_if_match text, p_if_none_match text), ,- Read object metadata for the latest or specified version.
pgs3.get(p_bucket text, p_key text, p_version_id bigint, p_if_match text, p_if_none_match text), ,- Read object metadata and full
body bytea. pgs3.get_range(p_bucket text, p_key text, p_start bigint, p_end bigint, p_version_id bigint, p_if_match text, p_if_none_match text), ,- Read an inclusive 0-based byte slice of an object.
pgs3.copy(p_source_bucket text, p_source_key text, p_destination_bucket text, p_destination_key text, p_source_version_id bigint, p_content_type text, p_meta jsonb, p_if_none_match text, p_if_match text, p_source_if_match text), ,- Copy an object or version by sharing its canonical SHA-256 blob.
pgs3.delete(p_bucket text, p_key text, p_version_id bigint), ,- Insert a delete marker when
p_version_idis NULL, or permanently delete that version. pgs3.list(p_bucket text, p_prefix text, p_delimiter text, p_start_after text, p_continuation_token text, p_max_keys integer), ,- List keys and common prefixes in indexed key order.
Credentials and runtime operations
pgs3.create_credential(p_access_key text, p_secret text, p_role_name name, p_enabled boolean), ,- Operator only. Create an S3 key pair bound to an unprivileged tenant role.
pgs3.rotate_credential(p_access_key text, p_new_secret text), ,- Operator only. Replace the signing secret for an existing key.
pgs3.set_credential_role(p_access_key text, p_role_name name), ,- Operator only. Reassign an access key to another unprivileged tenant role.
pgs3.set_credential_enabled(p_access_key text, p_enabled boolean), ,- Operator only. Suspend or re-enable an access key.
pgs3.stats, ,- Aggregated HTTP request counters, errors, latency buckets, bytes, and GC/upload backlog.
SQLSTATE to S3 error mapping
| SQLSTATE | HTTP | S3 error code |
|---|---|---|
P3B01 | 404 | NoSuchBucket |
P3K01 | 404 | NoSuchKey / NoSuchVersion |
P3U01 | 404 | NoSuchUpload |
P3C01 | 412 | PreconditionFailed |
P3N01 | 304 | NotModified (no XML body) |
P3R01 | 416 | InvalidRange |
P3E01 | 409 | BucketAlreadyExists |
P3F01 | 409 | BucketNotEmpty |
P3H01 | 400 | BadDigest |
P3P01 | 400 | InvalidPart / InvalidPartOrder / EntityTooSmall |
P3S01 | 400 | EntityTooLarge |
42501 | 403 | AccessDenied |
25006 | 503 | ServiceUnavailable (read-only standby) |
57014 | 503 | SlowDown (statement timeout) |
0A000 | 501 | NotImplemented |
| other | 500 | InternalError |
An allowlisted pgs3.error=<code> diagnostic detail takes precedence to distinguish finer variants such as NoSuchVersion, InvalidBucketName, or EntityTooSmall. HEAD and 304 responses omit XML bodies. For the complete protocol-to-SQL mapping, see api-sql-mapping.md.