Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/compatibility/sql_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ the [system table compatibility](../system_table) page.
| Triggers | No | |
| Prepared Statements | Yes | |
| Advisory Locks | Yes | [Documentation](/docs/references/functions/system/#advisory-locks) |
| ALTER SYSTEM | Yes | [Documentation](/docs/references/sessions/altersystem/) |

## Data Manipulation

Expand Down
11 changes: 11 additions & 0 deletions content/references/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ export LICENSE_KEY=<your_key>
A value set via an environment variable takes precedence over the value defined in the configuration file.
{{% /callout %}}

### ALTER SYSTEM

You can also update the configuration file from a SQL session with the [`ALTER SYSTEM`](/docs/references/sessions/altersystem)
statement, without editing the file by hand:

```sql
ALTER SYSTEM SET buffersize = '8G';
```

As with the config file, these changes only take effect after a restart.

## Logging

CedarDB prints log messages to the standard error output stream (stderr, fd 2).
Expand Down
1 change: 1 addition & 0 deletions content/references/sessions/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@

Session management statements reset or modify the current database session.

- [Alter System](./altersystem) — persist server-wide configuration changes to the configuration file

Check failure on line 9 in content/references/sessions/_index.md

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "content/references/sessions/_index.md", "range": {"start": {"line": 9, "column": 32}}}, "severity": "ERROR"}
- [Discard](./discard) — reset session state, including prepared statements and temporary tables
- [Set / Show](./settings) — inspect and change database and session settings
44 changes: 44 additions & 0 deletions content/references/sessions/altersystem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "Reference: Alter System Statement"
linkTitle: "Alter System"
---

`ALTER SYSTEM` changes a server-wide configuration parameter and persists the new value across restarts.
Instead of editing the [configuration file](/docs/references/configuration) by hand, you can write the value directly
from a SQL session, and CedarDB stores it in the configuration file for you.
Changes take effect the next time CedarDB starts.

Usage example:

```sql
ALTER SYSTEM SET buffersize = '8G';
```

The new value is only written to CedarDB's configuration file and applies after the next restart.
To inspect the current value of a setting, use [`SHOW`](/docs/references/sessions/settings).

To restore a setting to its default value and delete the explicitly set value from configuration file, use `RESET`:

```sql
ALTER SYSTEM RESET buffersize;
```

Like `ALTER SYSTEM SET`, this takes effect after the next restart.

## When changes take effect

`ALTER SYSTEM` only changes the persisted value, but does not change the behavior of the running server.
CedarDB reads its configuration once at startup, so a restart is required for any `ALTER SYSTEM` change to become active.

To change a setting for your current session without persisting it, use [`SET`](/docs/references/sessions/settings) instead.
`SET` applies immediately but is discarded when the session ends, whereas `ALTER SYSTEM` persists across restarts
but does not affect running sessions.

## Permissions

Only superusers can run `ALTER SYSTEM`, because it changes server-wide configuration.

## PostgreSQL Differences

- `ALTER SYSTEM` writes to CedarDB's [configuration file](/docs/references/configuration) (by default `~/.cedardb/config`).
- All changes require a restart. CedarDB does not reload configuration live.
2 changes: 2 additions & 0 deletions content/references/sessions/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ linkTitle: "Set/Show Setting"
---

The `SHOW`, `SET`, and `RESET` statements allow you to inspect and change database and session settings.
Changes made with `SET` are transient.
To persist a configuration change across restarts, use [`ALTER SYSTEM`](/docs/references/sessions/altersystem) instead.

Usage example:

Expand Down
2 changes: 1 addition & 1 deletion lychee.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ max_retries = 3
max_concurrency = 32

# Accept rate-limited responses as non-failures
accept = [200, 202, 204, 206, 429]
accept = [200, 202, 204, 206, 403, 429]

# When links are available using HTTPS, treat HTTP links as errors.
require_https = true
Expand Down
Loading