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

sql: support empty default_tablespace for compat #37333

Merged
merged 1 commit into from May 6, 2019
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 pkg/sql/logictest/testdata/logic_test/pg_catalog
Expand Up @@ -1491,6 +1491,7 @@ client_min_messages notice NULL NULL NULL
database test NULL NULL NULL string
datestyle ISO, MDY NULL NULL NULL string
default_int_size 8 NULL NULL NULL string
default_tablespace · NULL NULL NULL string
default_transaction_isolation serializable NULL NULL NULL string
default_transaction_read_only off NULL NULL NULL string
distsql off NULL NULL NULL string
Expand Down Expand Up @@ -1541,6 +1542,7 @@ client_min_messages notice NULL user NULL noti
database test NULL user NULL · test
datestyle ISO, MDY NULL user NULL ISO, MDY ISO, MDY
default_int_size 8 NULL user NULL 8 8
default_tablespace · NULL user NULL · ·
default_transaction_isolation serializable NULL user NULL default default
default_transaction_read_only off NULL user NULL off off
distsql off NULL user NULL off off
Expand Down Expand Up @@ -1587,6 +1589,7 @@ crdb_version NULL NULL NULL NULL NULL
database NULL NULL NULL NULL NULL
datestyle NULL NULL NULL NULL NULL
default_int_size NULL NULL NULL NULL NULL
default_tablespace NULL NULL NULL NULL NULL
default_transaction_isolation NULL NULL NULL NULL NULL
default_transaction_read_only NULL NULL NULL NULL NULL
distsql NULL NULL NULL NULL NULL
Expand Down
6 changes: 6 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/set
Expand Up @@ -201,6 +201,12 @@ SET bytea_output = hex
statement error invalid value for parameter "bytea_output": "bogus"
SET bytea_output = bogus

statement ok
SET default_tablespace = ''

statement error invalid value for parameter "default_tablespace": "bleepis"
SET default_tablespace = 'bleepis'

query T colnames
SHOW server_version
----
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/logictest/testdata/logic_test/show_source
Expand Up @@ -33,6 +33,7 @@ client_min_messages notice
database test
datestyle ISO, MDY
default_int_size 8
default_tablespace ·
default_transaction_isolation serializable
default_transaction_read_only off
distsql off
Expand Down
1 change: 0 additions & 1 deletion pkg/sql/unsupported_vars.go
Expand Up @@ -58,7 +58,6 @@ var UnsupportedVars = func(ss ...string) map[string]struct{} {
"debug_print_plan",
"debug_print_rewritten",
"default_statistics_target",
"default_tablespace",
"default_text_search_config",
"default_transaction_deferrable",
// "default_transaction_isolation",
Expand Down
15 changes: 15 additions & 0 deletions pkg/sql/vars.go
Expand Up @@ -257,6 +257,21 @@ var varGen = map[string]sessionVar{
return strconv.FormatInt(defaultIntSize.Get(sv), 10)
},
},
// See https://www.postgresql.org/docs/10/runtime-config-client.html.
// Supported only for pg compatibility - CockroachDB has no notion of
// tablespaces.
`default_tablespace`: {
Set: func(_ context.Context, m *sessionDataMutator, s string) error {
if s != "" {
return newVarValueError(`default_tablespace`, s, "")
}
return nil
},
Get: func(evalCtx *extendedEvalContext) string {
return ""
},
GlobalDefault: func(sv *settings.Values) string { return "" },
},
// See https://www.postgresql.org/docs/10/static/runtime-config-client.html#GUC-DEFAULT-TRANSACTION-ISOLATION
`default_transaction_isolation`: {
Set: func(_ context.Context, m *sessionDataMutator, s string) error {
Expand Down