SQLStreams

the messaging platform that is just Postgres

You last visited on 9999-99-99 Show what's new since then

Rename a stream

Edit this page
Stream · Related pages
Posted: 2026-09-16 · Report this thread
brandon Site Admin brandon profile Posts: 96
Rename(ctx context.Context, newName string) (*Stream, error)

Changes the stream’s registered name. Its id, settings, messages, and consumer groups are preserved. The old name becomes available for another registration.

Example

Rename the payments.requested stream to payments.pending using an initialized client.

payments := client.Stream[sqlstreams.RawPayload]("payments.requested")
renamed, err := payments.Rename(ctx, "payments.pending")
if err != nil {
return err
}
fmt.Println(renamed.Id, renamed.Name)

Parameters

Parameter Type Required Description
ctx context.Context Yes Cancellation or its deadline interrupts the operation.
newName string Yes An unused name matching ^[a-z0-9._-]+$, different from the current name.

Returns

Condition Return value
Rename succeeds (stream, nil), containing the updated stream object.
Rename fails (nil, err).

CLI

sqlstreams stream rename payments.requested payments.pending

Prints the old name, new name, and preserved id. --output json returns the updated registration.

Errors

Error When
Validation error A name is empty, the new name is invalid, or both names are identical.
ErrReservedStreamName Either name starts with __system..
ErrStreamNotFound The original stream is absent.
ErrStreamNameTaken The new name is already registered.
Database or context error The rename fails or is interrupted.