diff --git a/content/compatibility/sql_features.md b/content/compatibility/sql_features.md index f4d5c68..4d3bfc8 100644 --- a/content/compatibility/sql_features.md +++ b/content/compatibility/sql_features.md @@ -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 diff --git a/content/references/configuration.md b/content/references/configuration.md index 7135bed..ef10891 100644 --- a/content/references/configuration.md +++ b/content/references/configuration.md @@ -59,6 +59,17 @@ export LICENSE_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). diff --git a/content/references/sessions/_index.md b/content/references/sessions/_index.md index 61a69f9..cbef0b1 100644 --- a/content/references/sessions/_index.md +++ b/content/references/sessions/_index.md @@ -6,5 +6,6 @@ weight: 70 Session management statements reset or modify the current database session. +- [Alter System](./altersystem) — persist server-wide configuration changes to the configuration file - [Discard](./discard) — reset session state, including prepared statements and temporary tables - [Set / Show](./settings) — inspect and change database and session settings diff --git a/content/references/sessions/altersystem.md b/content/references/sessions/altersystem.md new file mode 100644 index 0000000..b84af07 --- /dev/null +++ b/content/references/sessions/altersystem.md @@ -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. diff --git a/content/references/sessions/settings.md b/content/references/sessions/settings.md index 24f8689..8698f91 100644 --- a/content/references/sessions/settings.md +++ b/content/references/sessions/settings.md @@ -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: diff --git a/lychee.toml b/lychee.toml index 053a0e6..64e6b3b 100644 --- a/lychee.toml +++ b/lychee.toml @@ -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