Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting standard_conforming_strings to on #10691

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/user/content/release-notes.md
Expand Up @@ -122,6 +122,9 @@ changes that have not yet been documented.
- Improve the clarity of any Avro schema resolution errors found when
creating materialized sources and views. {{% gh 8415 %}}

- Allow setting `standard_conforming_strings` to its default value of `on`.
Setting it to `off` is still not supported.

{{< comment >}}
Only add new release notes above this line.

Expand Down
10 changes: 9 additions & 1 deletion src/coord/src/session/vars.rs
Expand Up @@ -347,7 +347,15 @@ impl Vars {
} else if name == SQL_SAFE_UPDATES.name {
self.sql_safe_updates.set(value, local)
} else if name == STANDARD_CONFORMING_STRINGS.name {
Err(CoordError::ReadOnlyParameter(&STANDARD_CONFORMING_STRINGS))
match bool::parse(value) {
Ok(value) if value == *STANDARD_CONFORMING_STRINGS.value => Ok(()),
Ok(_) => Err(CoordError::ConstrainedParameter(
&STANDARD_CONFORMING_STRINGS,
)),
Err(()) => Err(CoordError::InvalidParameterType(
&STANDARD_CONFORMING_STRINGS,
)),
}
} else if name == TIMEZONE.name {
if UncasedStr::new(value) != TIMEZONE.value {
return Err(CoordError::ConstrainedParameter(&TIMEZONE));
Expand Down
13 changes: 13 additions & 0 deletions test/testdrive/session.td
Expand Up @@ -41,6 +41,19 @@ contains:parameter "client_encoding" can only be set to "UTF8"
! SET NAMES = "something";
contains:unrecognized configuration parameter "names"

# standard_conforming_strings is constrained to true
> SET standard_conforming_strings = ON;

> SET standard_conforming_strings = true;

> SET standard_conforming_strings TO TRUE;

! SET standard_conforming_strings = OFF;
contains:parameter "standard_conforming_strings" can only be set to "on"

! SET standard_conforming_strings = typo;
contains:parameter "standard_conforming_strings" requires a "boolean" value

> SET sql_safe_updates = on
> SHOW sql_safe_updates
on
Expand Down