github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/logictest/testdata/logic_test/set (about) 1 # LogicTest: local 2 3 statement error unrecognized configuration parameter "foo" 4 SET foo = bar 5 6 statement error unrecognized configuration parameter "foo" 7 SHOW foo 8 9 statement error database "foo" does not exist 10 SET database = foo 11 12 # Ensure that the failing SET DATABASE call did not alter the session. 13 # The default session.database value is "test". 14 statement ok 15 SHOW TABLES 16 17 statement ok 18 CREATE DATABASE foo 19 20 statement ok 21 SET database = foo 22 23 # Create a table in the session database. 24 statement ok 25 CREATE TABLE bar (k INT PRIMARY KEY) 26 27 # Verify that the table is indeed in "foo". 28 query TTT 29 SHOW TABLES FROM foo 30 ---- 31 public bar table 32 33 # Verify set to empty string. 34 statement ok 35 SET database = "" 36 37 query T colnames 38 SHOW database 39 ---- 40 database 41 ยท 42 43 statement error no database specified 44 SHOW TABLES 45 46 # Verify SHOW TABLES FROM works when there is no current database. 47 query TTT 48 SHOW TABLES FROM foo 49 ---- 50 public bar table 51 52 # SET statement succeeds, CREATE TABLE fails. 53 statement error pgcode 42P07 relation \"bar\" already exists 54 SET database = foo; CREATE TABLE bar (k INT PRIMARY KEY) 55 56 query T colnames 57 SHOW database 58 ---- 59 database 60 foo 61 62 # SET succeeds 63 query TTT 64 SHOW TABLES from foo 65 ---- 66 public bar table 67 68 statement error invalid variable name: "" 69 SET ROW (1, TRUE, NULL) 70 71 statement ok 72 SET application_name = helloworld 73 74 query T colnames 75 SHOW application_name 76 ---- 77 application_name 78 helloworld 79 80 # SESSION_USER is a special keyword, check that SHOW knows about it. 81 query T 82 SHOW session_user 83 ---- 84 root 85 86 ## Test SET ... TO DEFAULT works 87 88 statement ok 89 SET distsql TO ON 90 91 query T colnames 92 SHOW distsql 93 ---- 94 distsql 95 on 96 97 statement ok 98 SET distsql TO DEFAULT 99 100 query T colnames 101 SHOW distsql 102 ---- 103 distsql 104 off 105 106 ## Test that our no-op compatibility vars work 107 108 statement ok 109 SET application_name = 'hello' 110 111 statement ok 112 SET extra_float_digits = 0 113 114 statement error 123 is outside the valid range for parameter "extra_float_digits" 115 SET extra_float_digits = 123 116 117 statement ok 118 SET client_min_messages = 'debug1' 119 120 statement ok 121 SET standard_conforming_strings = 'on' 122 123 statement error invalid value for parameter "standard_conforming_strings": "off" 124 SET standard_conforming_strings = 'off' 125 126 statement ok 127 SET client_encoding = 'UTF8' 128 129 statement ok 130 SET client_encoding = 'UT! '' @#!$%%F------!@!!!8 '' ' 131 132 statement ok 133 SET client_encoding = 'unicode' 134 135 statement error unimplemented client encoding: "other" 136 SET client_encoding = 'other' 137 138 statement error parameter "server_encoding" cannot be changed 139 SET server_encoding = 'UTF8' 140 141 statement error parameter "server_encoding" cannot be changed 142 SET server_encoding = 'other' 143 144 statement ok 145 SET datestyle = 'ISO' 146 147 statement error invalid value for parameter "DateStyle": "other" 148 SET datestyle = 'other' 149 150 statement ok 151 SET intervalstyle = 'postgres' 152 153 statement error invalid value for parameter "IntervalStyle": "other" 154 SET intervalstyle = 'other' 155 156 statement ok 157 SET search_path = 'blah' 158 159 statement ok 160 SET distsql = always 161 162 statement ok 163 SET distsql = on 164 165 statement ok 166 SET distsql = off 167 168 statement error invalid value for parameter "distsql": "bogus" 169 SET distsql = bogus 170 171 statement ok 172 SET vectorize = '201auto' 173 174 statement ok 175 SET vectorize = on 176 177 statement ok 178 SET vectorize = experimental_always 179 180 statement ok 181 SET vectorize = off 182 183 statement error invalid value for parameter "vectorize": "bogus" 184 SET vectorize = bogus 185 186 statement ok 187 SET optimizer = on 188 189 statement error invalid value for parameter "optimizer": "local" 190 SET optimizer = local 191 192 statement error invalid value for parameter "optimizer": "off" 193 SET optimizer = off 194 195 statement error invalid value for parameter "optimizer": "bogus" 196 SET optimizer = bogus 197 198 statement ok 199 SET bytea_output = escape 200 201 statement ok 202 SET bytea_output = hex 203 204 statement error invalid value for parameter "bytea_output": "bogus" 205 SET bytea_output = bogus 206 207 statement ok 208 SET default_tablespace = '' 209 210 statement error invalid value for parameter "default_tablespace": "bleepis" 211 SET default_tablespace = 'bleepis' 212 213 query T colnames 214 SHOW server_version 215 ---- 216 server_version 217 9.5.0 218 219 query T colnames 220 SHOW server_version_num 221 ---- 222 server_version_num 223 90500 224 225 # Test read-only variables 226 statement error parameter "max_index_keys" cannot be changed 227 SET max_index_keys = 32 228 229 statement error parameter "node_id" cannot be changed 230 SET node_id = 123 231 232 query TT 233 SELECT name, value FROM system.settings WHERE name = 'testing.str' 234 ---- 235 236 # quoted identifiers 237 statement ok 238 SET "timezone" = 'UTC' 239 240 # even quoted in postgres the session variable names are 241 # case-insensitive for SET and SHOW. 242 statement ok 243 SET "TIMEZONE" = 'UTC' 244 245 query T 246 SHOW "TIMEZONE" 247 ---- 248 UTC 249 250 # without quoted identifiers 251 statement ok 252 SET timezone = 'UTC' 253 254 query T 255 SHOW timezone 256 ---- 257 UTC 258 259 # TIMEZONE alias - TIME ZONE two words/tokens 260 statement ok 261 SET TIME ZONE 'UTC' 262 263 query T 264 SHOW TIME ZONE 265 ---- 266 UTC 267 268 # Regression test for #19727 - invalid EvalContext used to evaluate arguments to set. 269 statement ok 270 SET application_name = current_timestamp()::string 271 272 # Test statement_timeout on a long-running query. 273 statement ok 274 SET statement_timeout = 1 275 276 statement error query execution canceled due to statement timeout 277 SELECT * FROM generate_series(1,1000000) 278 279 # Test that statement_timeout can be set with an interval string. 280 statement ok 281 SET statement_timeout = '0ms' 282 283 # Test that statement_timeout can be set with an interval string, defaulting to 284 # milliseconds as a unit. 285 statement ok 286 SET statement_timeout = '100' 287 288 query T 289 SHOW statement_timeout 290 ---- 291 100 292 293 # Test that composite variable names get rejected properly, especially 294 # when "tracing" is used as prefix. 295 296 statement error unrecognized configuration parameter "blah.blah" 297 SET blah.blah = 123 298 299 statement error unrecognized configuration parameter "tracing.blah" 300 SET tracing.blah = 123 301 302 statement error invalid value for parameter "ssl_renegotiation_limit" 303 SET ssl_renegotiation_limit = 123 304 305 statement ok 306 SET SESSION tracing=false 307 308 statement error pgcode 42601 expected string or boolean for set tracing argument 309 SET SESSION tracing=1 310 311 subtest regression_35109_flowable 312 313 statement ok 314 SET DATESTYLE = ISO; 315 SET INTERVALSTYLE = POSTGRES; 316 SET extra_float_digits TO 3; 317 SET synchronize_seqscans TO off; 318 SET statement_timeout = 0; 319 SET lock_timeout = 0; 320 SET idle_in_transaction_session_timeout = 0; 321 SET row_security = off; 322 323 subtest regression_41567_subqueries 324 325 statement error subqueries are not allowed in SET 326 SET SESSION SCHEMA EXISTS ( TABLE ( ( ( ( ( ( ( ( TABLE error ) ) ) ) ) ) ) ) ORDER BY INDEX FAMILY . IS . MAXVALUE @ OF DESC , INDEX FAMILY . FOR . ident @ ident ASC ) 327 328 statement error subqueries are not allowed in SET 329 USE EXISTS ( TABLE error ) IS NULL 330 331 statement error subqueries are not allowed in SET 332 PREPARE a AS USE EXISTS ( TABLE error ) IS NULL 333 334 subtest bools 335 # Ensure that we can set variables to on/off and yes/no. 336 statement ok 337 SET enable_zigzag_join = 'on'; 338 SET enable_zigzag_join = 'off'; 339 SET enable_zigzag_join = 'true'; 340 SET enable_zigzag_join = 'false'; 341 SET enable_zigzag_join = 'yes'; 342 SET enable_zigzag_join = 'no'; 343 SET enable_zigzag_join = on; 344 SET enable_zigzag_join = off; 345 SET enable_zigzag_join = true; 346 SET enable_zigzag_join = false; 347 SET enable_zigzag_join = yes; 348 SET enable_zigzag_join = no 349 350 # Check error code. 351 statement error pgcode 22023 parameter "enable_zigzag_join" requires a Boolean value 352 SET enable_zigzag_join = nonsense