Server IP : 104.21.38.3 / Your IP : 172.71.124.172 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/sys_vars/t/ |
Upload File : |
############ mysql-test\t\updatable_views_with_limit_func.test ################# # # #Variable Name: updatable_views_with_limit # #Scope: SESSION # #Access Type: Dynamic # #Data Type: Enumeration # #Default Value: - # #Values: - # # # # # #Creation Date: 2008-03-02 # #Author: Sharique Abdullah # # # #Description: Test Cases of Dynamic System Variable "updatable_views_with_limit# # that checks behavior of this variable in the following ways # # * Functionality based on different values # # # #Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html# #option_mysqld_updatable_views_with_limit # # # ################################################################################ # # Setup # SET @session_updatable_views_with_limit = @@Session.UPDATABLE_VIEWS_WITH_LIMIT; --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings ################################ # Creating table # ################################ CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b)); ################################## # Inserting values in the table # ################################## INSERT INTO t1 VALUES (10,2,-1), (20,3,-2), (30,4,-3), (40,5,-4); #################################### # Creating views # #################################### CREATE VIEW v1 (x,y) AS SELECT a, c FROM t1; --echo ** Connecting test_con1 using username 'root' ** CONNECT (test_con1,localhost,root,,); --echo ** Connection test_con1 ** CONNECTION test_con1; SET @@Session.UPDATABLE_VIEWS_WITH_LIMIT=YES; # # Testing WITH a limit clause # --echo Warning expected, 'View does not contain complete key of the table' UPDATE v1 SET x=x+6 LIMIT 1; SELECT * FROM t1; # # Testing WITHOUT a limit clause # UPDATE v1 SET x=x+5; SELECT * FROM t1; --echo ** Connecting test_con2 using username 'root' ** CONNECT (test_con2,localhost,root,,); --echo ** Connection test_con2 ** CONNECTION test_con2; SET @@Session.UPDATABLE_VIEWS_WITH_LIMIT=NO; SELECT @@SESSION.UPDATABLE_VIEWS_WITH_LIMIT; --ERROR ER_NON_UPDATABLE_TABLE UPDATE v1 SET x=x+10 LIMIT 1; --echo Expected error 'Non updatable table' SELECT * FROM t1; --echo '#---------------------FN_DYNVARS_039_01----------------------#' ###################################### # Setting value to NO # ###################################### SET UPDATABLE_VIEWS_WITH_LIMIT=NO; -- error ER_NON_UPDATABLE_TABLE UPDATE v1 SET x=x+1 LIMIT 1; --echo Expected error 'Non updatable table' SET UPDATABLE_VIEWS_WITH_LIMIT=0; -- error ER_NON_UPDATABLE_TABLE UPDATE v1 SET x=x+1 LIMIT 1; --echo Expected error 'Non updatable table' --echo '#---------------------FN_DYNVARS_039_02----------------------#' ###################################### # Setting value to Default # ###################################### --echo Warning expected, 'View does not contain complete key of the table' SET UPDATABLE_VIEWS_WITH_LIMIT=DEFAULT; UPDATE v1 SET x=x+1 LIMIT 1; --echo Warning expected, 'View does not contain complete key of the table' SET UPDATABLE_VIEWS_WITH_LIMIT=YES; UPDATE v1 SET x=x+2 LIMIT 1; # # Cleanup # --echo ** Connection default ** connection default; --echo ** Disconnecting test_con1, test_con2 ** disconnect test_con1; disconnect test_con2; SET @@SESSION.updatable_views_with_limit = @session_updatable_views_with_limit; --disable_warnings DROP VIEW IF EXISTS v1; DROP TABLE IF EXISTS t1; --enable_warnings