Commit 5ffbbfce authored by joerg@trift2's avatar joerg@trift2

Merge trift2.:/MySQL/M51/mysql-5.1

into  trift2.:/MySQL/M51/push-5.1
parents dbcd4d9e b83b0287
......@@ -3012,3 +3012,8 @@ win/vs8cache.txt
ylwrap
zlib/*.ds?
zlib/*.vcproj
mysql-test/funcs_1.log
mysql-test/funcs_1.tar
mysql-test/suite/funcs_1.tar.gz
mysql-test/.DS_Store
.DS_Store
#! /usr/bin/perl
use strict;
use warnings;
use FindBin;
require "$FindBin::Bin/triggers-lib.pl";
# Don't run unless commit was successful
check_status() || exit 0;
my $cset = latest_cset();
# Read most recent ChangeSet's changed files. Send merge changes along, since
# they'll need to be incorporated in InnoDB's source tree eventually.
my $changes = innodb_get_changes('cset', $cset, 'yes')
or exit 0;
innodb_send_changes_email($cset, $changes)
or exit 1;
exit 0;
#! /usr/bin/perl
use strict;
use warnings;
use FindBin;
require "$FindBin::Bin/triggers-lib.pl";
# Don't run unless push/pull was successful
check_status() or exit 0;
# Don't run if push/pull is in local clones
exit 0 if repository_type() eq 'local';
# For each pushed ChangeSet, check it for InnoDB files and send
# diff of entire ChangeSet to InnoDB developers if such changes
# exist.
my $error = 0;
foreach my $cset (read_bk_csetlist())
{
my $changes = innodb_get_changes('cset', $cset, 'yes')
or next;
innodb_send_changes_email($cset, $changes)
or $error = 1;
}
exit ($error == 0 ? 0 : 1);
#! /usr/bin/perl
use strict;
use warnings;
use FindBin;
require "$FindBin::Bin/triggers-lib.pl";
die "$0: Script error: \$BK_PENDING is not set in pre-commit trigger\n"
unless defined $ENV{BK_PENDING};
# Read changed files from $BK_PENDING directly. Do not bother user about
# merge changes; they don't have any choice, the merge must be done.
my $changes = innodb_get_changes('file', $ENV{BK_PENDING}, undef)
or exit 0;
innodb_inform_and_query_user($changes)
or exit 1; # Abort commit
# OK, continue with commit
exit 0;
# To use this convenience library in a trigger, simply require it at
# at the top of the script. For example:
#
# #! /usr/bin/perl
#
# use FindBin;
# require "$FindBin::Bin/triggers-lib.pl";
#
# FindBin is needed, because sometimes a trigger is called from the
# RESYNC directory, and the trigger dir is ../BitKeeper/triggers
use strict;
use warnings;
use Carp;
use FindBin;
my $mysql_version = "5.1";
# These addresses must be kept current in all MySQL versions.
# See the wiki page InnoDBandOracle.
#my @innodb_to_email = ('dev_innodb_ww@oracle.com');
#my @innodb_cc_email = ('dev-innodb@mysql.com');
# FIXME: Keep this for testing; remove it once it's been used for a
# week or two.
my @innodb_to_email = ('tim@mysql.com');
my @innodb_cc_email = ();
# This is for MySQL >= 5.1. Regex which defines the InnoDB files
# which should generally not be touched by MySQL developers.
my $innodb_files_description = <<EOF;
storage/innobase/*
mysql-test/t/innodb* (except mysql-test/t/innodb_mysql*)
mysql-test/r/innodb* (except mysql-test/r/innodb_mysql*)
EOF
my $innodb_files_regex = qr{
^
(
# Case 1: innobase/*
storage/innobase/
|
# Case 2: mysql-test/[tr]/innodb* (except innodb_mysql*)
mysql-test/(t|r)/SCCS/s.innodb
# The mysql-test/[tr]/innodb_mysql* are OK to edit
(?!_mysql)
)
}x;
# See 'bk help log', and the format of, e.g., $BK_PENDING.
# Important: this already contains the terminating newline!
my $file_rev_dspec = ':SFILE:|:REV:\n';
my $bktmp = "$FindBin::Bin/../tmp";
my $sendmail;
foreach ('/usr/sbin/sendmail', 'sendmail') {
$sendmail = $_;
last if -x $sendmail;
}
my $from = $ENV{REAL_EMAIL} || $ENV{USER} . '@mysql.com';
# close_or_warn
# $fh file handle to be closed
# $description description of the file handle
# RETURN Return value of close($fh)
#
# Print a nice warning message if close() isn't successful. See
# perldoc perlvar and perldoc -f close for details.
sub close_or_warn (*$)
{
my ($fh, $description) = @_;
my $status = close $fh;
if (not $status) {
warn "$0: error on close of '$description': ",
($! ? "$!" : "exit status " . ($? >> 8)), "\n";
}
return $status;
}
# check_status
# $warn If true, warn about bad status
# RETURN TRUE, if $BK_STATUS is "OK"; FALSE otherwise
#
# Also checks the undocumented $BK_COMMIT env variable
sub check_status
{
my ($warn) = @_;
my $status = (grep { defined $_ }
$ENV{BK_STATUS}, $ENV{BK_COMMIT}, '<undef>')[0];
unless ($status eq 'OK')
{
warn "Bad BK_STATUS '$status'\n" if $warn;
return undef;
}
return 1;
}
# repository_location
#
# RETURN ('HOST', 'ROOT') for the repository being modified
sub repository_location
{
if ($ENV{BK_SIDE} eq 'client') {
return ($ENV{BK_HOST}, $ENV{BK_ROOT});
} else {
return ($ENV{BKD_HOST}, $ENV{BKD_ROOT});
}
}
# repository_type
# RETURN:
# 'main' for repo on bk-internal with post-incoming.bugdb trigger
# 'team' for repo on bk-internal with post-incoming.queuepush.pl trigger
# 'local' otherwise
#
# This definition may need to be modified if the host name or triggers change.
sub repository_type
{
my ($host, $root) = repository_location();
return 'local'
unless uc($host) eq 'BK-INTERNAL.MYSQL.COM'
and -e "$root/BitKeeper/triggers/post-incoming.queuepush.pl";
return 'main' if -e "$root/BitKeeper/triggers/post-incoming.bugdb";
return 'team';
}
# latest_cset
# RETURN Key for most recent ChangeSet
sub latest_cset {
chomp(my $retval = `bk changes -r+ -k`);
return $retval;
}
# read_bk_csetlist
# RETURN list of cset keys from $BK_CSETLIST file
sub read_bk_csetlist
{
die "$0: script error: \$BK_CSETLIST not set\n"
unless defined $ENV{BK_CSETLIST};
open CSETS, '<', $ENV{BK_CSETLIST}
or die "$0: can't read \$BK_CSETLIST='$ENV{BK_CSETLIST}': $!\n";
chomp(my @csets = <CSETS>);
close_or_warn(CSETS, "\$BK_CSETLIST='$ENV{BK_CSETLIST}'");
return @csets;
}
# innodb_get_changes
# $type 'file' or 'cset'
# $value file name (e.g., $BK_PENDING) or ChangeSet key
# $want_merge_changes flag; if false, merge changes will be ignored
# RETURN A string describing the InnoDB changes, or undef if no changes
#
# The return value does *not* include ChangeSet comments, only per-file
# comments.
sub innodb_get_changes
{
my ($type, $value, $want_merge_changes) = @_;
if ($type eq 'file')
{
open CHANGES, '<', $value
or die "$0: can't read '$value': $!\n";
}
elsif ($type eq 'cset')
{
open CHANGES, '-|', "bk changes -r'$value' -v -d'$file_rev_dspec'"
or die "$0: can't exec 'bk changes': $!\n";
}
else
{
croak "$0: script error: invalid type '$type'";
}
my @changes = grep { /$innodb_files_regex/ } <CHANGES>;
close_or_warn(CHANGES, "($type, '$value')");
return undef unless @changes;
# Set up a pipeline of 'bk log' commands to weed out unwanted deltas. We
# never want deltas which contain no actual changes. We may not want deltas
# which are merges.
my @filters;
# This tests if :LI: (lines inserted) or :LD: (lines deleted) is
# non-zero. That is, did this delta change the file contents?
push @filters,
"bk log -d'"
. "\$if(:LI: -gt 0){$file_rev_dspec}"
. "\$if(:LI: -eq 0){\$if(:LD: -gt 0){$file_rev_dspec}}"
. "' -";
push @filters, "bk log -d'\$unless(:MERGE:){$file_rev_dspec}' -"
unless $want_merge_changes;
my $tmpname = "$bktmp/ibchanges.txt";
my $pipeline = join(' | ', @filters) . " > $tmpname";
open TMP, '|-', $pipeline
or die "$0: can't exec [[$pipeline]]: $!\n";
print TMP @changes;
close_or_warn(TMP, "| $pipeline");
# Use bk log to describe the changes
open LOG, "bk log - < $tmpname |"
or die "$0: can't exec 'bk log - < $tmpname': $!\n";
my @log = <LOG>;
close_or_warn(LOG, "bk log - < $tmpname |");
unlink $tmpname;
return undef unless @log;
return join('', @log);
}
# Ask user if they really want to commit.
# RETURN TRUE = YES, commit; FALSE = NO, do not commit
sub innodb_inform_and_query_user
{
my ($description) = @_;
my $tmpname = "$bktmp/ibquery.txt";
open MESSAGE, "> $tmpname"
or die "$0: can't write message to '$tmpname': $!";
print MESSAGE <<EOF;
This ChangeSet modifies some files which should normally be changed by
InnoDB developers only. In general, MySQL developers should not change:
$innodb_files_description
The following InnoDB files were modified:
=========================================================
$description
=========================================================
If you understand this, you may Commit these changes. The changes
will be sent to the InnoDB developers at @{[join ', ', @innodb_to_email]},
CC @{[join ', ', @innodb_cc_email]}.
EOF
close_or_warn(MESSAGE, "$tmpname");
my $status = system('bk', 'prompt', '-w',
'-yCommit these changes', '-nDo not Commit', "-f$tmpname");
unlink $tmpname;
return ($status == 0 ? 1 : undef);
}
# innodb_send_changes_email
# $cset The ChangeSet key
# $description A (maybe brief) description of the changes
# RETURN TRUE = Success, e-mail sent; FALSE = Failure
#
# Sends a complete diff of changes in $cset by e-mail.
sub innodb_send_changes_email
{
my ($cset, $description) = @_;
# FIXME: Much of this is duplicated in the 'post-commit' Bourne shell
# trigger
my $cset_short = `bk changes -r'$cset' -d':P:::I:'`;
my $cset_key = `bk changes -r'$cset' -d':KEY:'`;
my ($host, $bk_root) = repository_location();
my $type = repository_type();
(my $treename = $bk_root) =~ s,^.*/,,;
print "Nofifying InnoDB developers at ",
(join ', ', @innodb_to_email, @innodb_cc_email), "\n";
open SENDMAIL, '|-', "$sendmail -t"
or die "Can't exec '$sendmail -t': $!\n";
my @headers;
push @headers, "List-ID: <bk.innodb-$mysql_version>";
push @headers, "From: $from";
push @headers, "To: " . (join ', ', @innodb_to_email);
push @headers, "Cc: " . (join ', ', @innodb_cc_email) if @innodb_cc_email;
push @headers,
"Subject: InnoDB changes in $type $mysql_version tree ($cset_short)";
push @headers, "X-CSetKey: <$cset_key>";
print SENDMAIL map { "$_\n" } @headers, '';
if ($type eq 'main')
{
print SENDMAIL <<EOF;
Changes pushed to $treename by $ENV{USER} affect the following
files. These changes are in a $mysql_version main tree. They
will be available publicly within 24 hours.
EOF
}
elsif ($type eq 'team')
{
print SENDMAIL <<EOF;
Changes added to $treename by $ENV{USER} affect the
following files. These changes are in a $mysql_version team tree.
EOF
}
else
{
print SENDMAIL <<EOF;
A local commit by $ENV{USER} affects the following files. These
changes are in a clone of a $mysql_version tree.
EOF
}
print SENDMAIL "\n";
print SENDMAIL qx(bk changes -r'$cset');
print SENDMAIL "$description";
print SENDMAIL "The complete ChangeSet diffs follow.\n\n";
print SENDMAIL qx(bk rset -r'$cset' -ah | bk gnupatch -h -dup -T);
close_or_warn(SENDMAIL, "$sendmail -t")
or return undef;
return 1;
}
1;
......@@ -27,7 +27,7 @@
#endif
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <stdio.h>
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include "rlconf.h"
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <stdio.h>
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#if !defined (BUFSIZ)
......
......@@ -23,7 +23,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <stdio.h>
......
......@@ -31,7 +31,7 @@
#endif
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <stdio.h>
......
......@@ -26,7 +26,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <stdio.h>
......
......@@ -23,7 +23,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <stdio.h>
......
......@@ -26,7 +26,7 @@
#endif
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -27,7 +27,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -21,7 +21,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#if defined (HAVE_STDLIB_H)
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#if defined (HAVE_UNISTD_H)
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -28,7 +28,7 @@
#include "rlconf.h"
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <stdio.h>
......
......@@ -23,7 +23,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -27,7 +27,7 @@
#define _RLDEFS_H_
#if defined (HAVE_CONFIG_H)
# include "config.h"
# include "config_readline.h"
#endif
#include "rlstdc.h"
......
......@@ -23,7 +23,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -26,7 +26,7 @@
#define _RLWINSIZE_H_
#if defined (HAVE_CONFIG_H)
# include "config.h"
# include "config_readline.h"
#endif
/* Try to find the definitions of `struct winsize' and TIOGCWINSZ */
......
......@@ -21,7 +21,7 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include <config.h>
#include "config_readline.h"
#ifdef HAVE_STRING_H
# include <string.h>
#endif
......
......@@ -23,7 +23,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -23,7 +23,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <stdio.h> /* Just for NULL. Yuck. */
......
......@@ -25,7 +25,7 @@
#define _RLTCAP_H_
#if defined (HAVE_CONFIG_H)
# include "config.h"
# include "config_readline.h"
#endif
#if defined (HAVE_TERMCAP_H)
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#if defined (HAVE_UNISTD_H)
......
......@@ -20,7 +20,7 @@
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#if defined (HAVE_UNISTD_H)
......
......@@ -23,7 +23,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -22,7 +22,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -32,7 +32,7 @@
#if defined (VI_MODE)
#if defined (HAVE_CONFIG_H)
# include <config.h>
# include "config_readline.h"
#endif
#include <sys/types.h>
......
......@@ -21,7 +21,7 @@
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
#include <config.h>
#include "config_readline.h"
#endif
#include <stdio.h>
......
......@@ -44,6 +44,9 @@ TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock3
ADD_EXECUTABLE(perror perror.c)
TARGET_LINK_LIBRARIES(perror strings mysys debug dbug wsock32)
ADD_EXECUTABLE(resolveip resolveip.c)
TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32)
ADD_EXECUTABLE(replace replace.c)
TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32)
......
......@@ -21,13 +21,15 @@
#include <m_ctype.h>
#include <my_sys.h>
#include <m_string.h>
#include <sys/types.h>
#include <sys/socket.h>
#ifndef HAVE_BROKEN_NETINET_INCLUDES
#include <netinet/in.h>
#ifndef WIN32
# include <sys/types.h>
# include <sys/socket.h>
# ifndef HAVE_BROKEN_NETINET_INCLUDES
# include <netinet/in.h>
# endif
# include <arpa/inet.h>
# include <netdb.h>
#endif
#include <arpa/inet.h>
#include <netdb.h>
#include <my_net.h>
#include <my_getopt.h>
......
......@@ -527,6 +527,11 @@ void ProcessOldClientHello(input_buffer& input, SSL& ssl)
input.read(len, sizeof(len));
uint16 randomLen;
ato16(len, randomLen);
if (ch.suite_len_ > MAX_SUITE_SZ || sessionLen > ID_LEN ||
randomLen > RAN_LEN) {
ssl.SetError(bad_input);
return;
}
int j = 0;
for (uint16 i = 0; i < ch.suite_len_; i += 3) {
......
......@@ -101,6 +101,7 @@ template void ysArrayDelete<unsigned char>(unsigned char*);
template void ysArrayDelete<char>(char*);
template int min<int>(int, int);
template uint16 min<uint16>(uint16, uint16);
template unsigned int min<unsigned int>(unsigned int, unsigned int);
template unsigned long min<unsigned long>(unsigned long, unsigned long);
}
......
......@@ -621,6 +621,10 @@ void HandShakeHeader::Process(input_buffer& input, SSL& ssl)
}
uint len = c24to32(length_);
if (len > input.get_remaining()) {
ssl.SetError(bad_input);
return;
}
hashHandShake(ssl, input, len);
hs->set_length(len);
......@@ -1391,10 +1395,15 @@ input_buffer& operator>>(input_buffer& input, ClientHello& hello)
// Suites
byte tmp[2];
uint16 len;
tmp[0] = input[AUTO];
tmp[1] = input[AUTO];
ato16(tmp, hello.suite_len_);
ato16(tmp, len);
hello.suite_len_ = min(len, static_cast<uint16>(MAX_SUITE_SZ));
input.read(hello.cipher_suites_, hello.suite_len_);
if (len > hello.suite_len_) // ignore extra suites
input.set_current(input.get_current() + len - hello.suite_len_);
// Compression
hello.comp_len_ = input[AUTO];
......
# ===== csv_not_null.1 =====
DROP TABLE IF EXISTS t1, t2;
# === Will fail -- no NOT NULL ===
CREATE TABLE t1 (a int) ENGINE = CSV;
ERROR 42000: The storage engine for the table doesn't support nullable columns
# === Good CREATE ===
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
# === Will fail -- ALL columns need NOT NULL ==
CREATE TABLE t2 (a int NOT NULL, b char(20)) ENGINE = CSV;
ERROR 42000: The storage engine for the table doesn't support nullable columns
DROP TABLE t1;
# ===== csv_not_null.2 =====
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int NOT NULL, b blob NOT NULL, c CHAR(20) NOT NULL,
d VARCHAR(20) NOT NULL, e enum('foo','bar') NOT NULL,f DATE NOT NULL)
ENGINE = CSV;
# === should result in default for each datatype ===
INSERT INTO t1 VALUES();
SELECT * FROM t1;
a b c d e f
0 foo 0000-00-00
SELECT * FROM t1;
a b c d e f
0 foo 0000-00-00
INSERT INTO t1 VALUES(0,'abc','def','ghi','bar','1999-12-31');
SELECT * FROM t1;
a b c d e f
0 foo 0000-00-00
0 abc def ghi bar 1999-12-31
# === insert failures ===
INSERT INTO t1 VALUES(NULL,'ab','a','b','foo','2007-01-01');
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 VALUES(default(a),default(b), default(c), default(d),
default(e), default(f));
ERROR HY000: Field 'a' doesn't have a default value
DROP TABLE t1;
# ===== csv_not_null.3 =====
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int NOT NULL, b char(10) NOT NULL) ENGINE = CSV;
INSERT INTO t1 VALUES();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1364 Field 'b' doesn't have a default value
SELECT * FROM t1;
a b
0
UPDATE t1 set b = 'new_value' where a = 0;
SELECT * FROM t1;
a b
0 new_value
UPDATE t1 set b = NULL where b = 'new_value';
Warnings:
Warning 1048 Column 'b' cannot be null
SELECT * FROM t1;
a b
0
DROP TABLE t1;
......@@ -3218,3 +3218,16 @@ a
2
DROP TABLE t1;
DROP TABLE t2;
create table t1 (i int, j int) engine=innodb;
insert into t1 (i, j) values (1, 1), (2, 2);
update t1 set j = 2;
affected rows: 1
info: Rows matched: 2 Changed: 1 Warnings: 0
drop table t1;
create table t1 (id int) comment='this is a comment' engine=innodb;
select table_comment, data_free > 0 as data_free_is_set
from information_schema.tables
where table_schema='test' and table_name = 't1';
table_comment data_free_is_set
this is a comment 1
drop table t1;
......@@ -13,33 +13,33 @@ DROP TABLE t1;
create table t1 (a int) engine=innodb partition by hash(a) ;
show table status like 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int)
engine = innodb
partition by key (a);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (0), (1), (2), (3);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB 10 Compact 4 4096 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
t1 InnoDB 10 Compact 4 4096 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int auto_increment primary key)
engine = innodb
partition by key (a);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB 10 Compact 2 8192 16384 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL partitioned
t1 InnoDB 10 Compact 2 8192 16384 0 0 # 1 NULL NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (NULL), (NULL), (NULL), (NULL);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB 10 Compact 4 4096 16384 0 0 0 5 NULL NULL NULL latin1_swedish_ci NULL partitioned
t1 InnoDB 10 Compact 4 4096 16384 0 0 # 5 NULL NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (NULL), (NULL), (NULL), (NULL);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB 10 Compact 8 2048 16384 0 0 0 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
t1 InnoDB 10 Compact 8 2048 16384 0 0 # 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int)
partition by key (a)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -58,6 +58,7 @@ load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11;
Section 3.1.10 - CALL checks:
--------------------------------------------------------------------------------
USE db_storedproc;
Testcase 3.1.10.2 + 3.1.10.5:
-----------------------------
......@@ -94,6 +95,7 @@ CALL sp31102();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102'
SELECT fn31105( 9 );
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105'
connection default;
USE db_storedproc;
root@localhost db_storedproc
......@@ -114,6 +116,7 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
connection default;
USE db_storedproc;
root@localhost db_storedproc
......@@ -180,6 +183,8 @@ DROP PROCEDURE IF EXISTS sp_ins_1;
DROP PROCEDURE IF EXISTS sp_ins_3;
DROP PROCEDURE IF EXISTS sp_upd;
DROP PROCEDURE IF EXISTS sp_ins_upd;
DROP PROCEDURE IF EXISTS sp_del;
DROP PROCEDURE IF EXISTS sp_with_rowcount;
CREATE TABLE temp(f1 CHAR(20),f2 CHAR(25),f3 DATE,f4 INT,f5 CHAR(25),f6 INT);
INSERT INTO temp SELECT * FROM t10;
CREATE PROCEDURE sp_ins_1()
......@@ -207,49 +212,72 @@ END;
SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1;
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc';
END//
CREATE PROCEDURE sp_del()
BEGIN
DELETE FROM temp WHERE temp.f1 ='qwe' OR temp.f1 = 'updated_2';
END//
CREATE PROCEDURE sp_with_rowcount()
BEGIN
BEGIN
INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000),
('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000),
('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000),
('qwe', 'xyz', '2005-11-07', 100, 'uvw', 1000);
END;
SELECT row_count() AS 'row_count() after insert';
SELECT row_count() AS 'row_count() after select row_count()';
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f2 = 'abc';
SELECT row_count() AS 'row_count() after update';
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
DELETE FROM temp WHERE temp.f1 = 'updated_2';
SELECT row_count() AS 'row_count() after delete';
END//
CALL sp_ins_1();
SELECT row_count();
row_count()
1
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
abc abc 2005-10-03 100 uvw 1000
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
abc abc 2005-10-03 100 uvw 1000
CALL sp_ins_3();
SELECT row_count();
row_count()
1
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
abc abc 2005-10-03 100 uvw 1000
abc xyz 1949-05-23 100 uvw 1000
abc xyz 1989-11-09 100 uvw 1000
abc xyz 2005-10-24 100 uvw 1000
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
abc abc 2005-10-03 100 uvw 1000
abc xyz 1949-05-23 100 uvw 1000
abc xyz 1989-11-09 100 uvw 1000
abc xyz 2005-10-24 100 uvw 1000
CALL sp_upd();
SELECT row_count();
row_count()
4
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
......@@ -258,8 +286,6 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
......@@ -281,8 +307,10 @@ COUNT( f1 ) f1
SELECT row_count();
row_count()
3
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
......@@ -291,20 +319,67 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
qwe xyz 1998-03-26 100 uvw 1000
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
updated xyz 2005-10-24 100 uvw 1000
updated_2 abc 1989-11-09 100 uvw 1000
qwe xyz 1998-03-26 100 uvw 1000
updated_2 abc 2000-11-09 100 uvw 1000
updated_2 abc 2005-11-07 100 uvw 1000
CALL sp_del();
SELECT row_count();
row_count()
4
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
updated xyz 2005-10-24 100 uvw 1000
DELETE FROM temp;
CALL sp_with_rowcount();
row_count() after insert
4
row_count() after select row_count()
-1
f1 f2 f3
qwe abc 1989-11-09
qwe abc 2000-11-09
qwe xyz 1998-03-26
qwe xyz 2005-11-07
row_count() after update
2
f1 f2 f3
qwe xyz 1998-03-26
qwe xyz 2005-11-07
updated_2 abc 1989-11-09
updated_2 abc 2000-11-09
row_count() after delete
2
SELECT row_count();
row_count()
-1
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
qwe xyz 1998-03-26 100 uvw 1000
qwe xyz 2005-11-07 100 uvw 1000
DROP PROCEDURE sp_ins_1;
DROP PROCEDURE sp_ins_3;
DROP PROCEDURE sp_upd;
DROP PROCEDURE sp_ins_upd;
DROP PROCEDURE sp_del;
DROP PROCEDURE sp_with_rowcount;
DROP TABLE temp;
Testcase 3.1.10.8:
......
......@@ -184,15 +184,14 @@ insert 3.5.3.2-no
insert 3.5.3.6-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4a_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1a';
insert into t1 (f1) values ('insert 3.5.3.7-1a');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
drop trigger trg4a_1;
......@@ -210,7 +209,6 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
......@@ -239,29 +237,27 @@ Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4b_1 before UPDATE on t1 for each row
set new.f1 = 'trig 3.5.3.7-1b';
insert into t1 (f1) values ('insert 3.5.3.7-1b');
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b';
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update 3.5.3.7-1b
drop trigger trg4b_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -275,23 +271,21 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
insert 3.5.3.7-2b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update 3.5.3.7-1b
update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b';
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
update 3.5.3.7-1b
drop trigger trg4b_2;
Testcase 3.5.3.7c
......@@ -317,21 +311,19 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4c_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1c';
insert into t1 (f1) values ('insert 3.5.3.7-1c');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
update 3.5.3.7-1b
drop trigger trg4c_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -345,14 +337,12 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
update 3.5.3.7-1b
drop trigger trg4c_2;
Testcase 3.5.3.7d:
......@@ -376,23 +366,20 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4d_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1d';
insert into t1 (f1) values ('insert 3.5.3.7-1d');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1d
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
update 3.5.3.7-1b
drop trigger trg4d_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -406,16 +393,13 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1d
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
trig 3.5.3.7-2d
update 3.5.3.7-1b
drop trigger trg4d_2;
Testcase 3.5.3.8a:
......@@ -440,14 +424,14 @@ use priv_db;
show grants;
Grants for test_noprivs@localhost
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5a_1 before INSERT on t1 for each row
set @test_var = new.f1;
set @test_var = 'before trig 3.5.3.8-1a';
select @test_var;
@test_var
before trig 3.5.3.8-1a
insert into t1 (f1) values ('insert 3.5.3.8-1a');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1a
......@@ -495,15 +479,15 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5b_1 before UPDATE on t1 for each row
set @test_var= new.f1;
set @test_var= 'before trig 3.5.3.8-1b';
insert into t1 (f1) values ('insert 3.5.3.8-1b');
select @test_var;
@test_var
before trig 3.5.3.8-1b
update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b';
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1b
......@@ -550,11 +534,11 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5c_1 before INSERT on t1 for each row
set @test_var= new.f1;
set @test_var= 'before trig 3.5.3.8-1c';
insert into t1 (f1) values ('insert 3.5.3.8-1c');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1c
......@@ -596,11 +580,11 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5d_1 before INSERT on t1 for each row
set @test_var= new.f1;
set @test_var='before trig 3.5.3.8-1d';
insert into t1 (f1) values ('insert 3.5.3.8-1d');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1d
......
......@@ -139,10 +139,10 @@ values ('1', 'Test 3.5.8.4', 222, 23456, 1.05);
Select f120, f122, f136, f144, f163 from tb3 where f122= 'Test 3.5.8.4';
f120 f122 f136 f144 f163
1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000
select * from db_test.t1_i order by i120;
select * from db_test.t1_i;
i120 i136 i144 i163
1 00222 0000023456 1.050000000000000000000000000000
select * from db_test.t1_u order by u120;
select * from db_test.t1_u;
u120 u136 u144 u163
a 00111 0000099999 999.990000000000000000000000000000
b 00222 0000023456 1.050000000000000000000000000000
......@@ -150,7 +150,7 @@ c 00333 0000099999 999.990000000000000000000000000000
d 00222 0000023456 1.050000000000000000000000000000
e 00222 0000023456 1.050000000000000000000000000000
f 00333 0000099999 999.990000000000000000000000000000
select * from db_test.t1_d order by d120;
select * from db_test.t1_d;
d120 d136 d144 d163
a 00111 0000099999 999.990000000000000000000000000000
c 00333 0000099999 999.990000000000000000000000000000
......@@ -343,20 +343,20 @@ set @test_var='Empty';
Insert into tb3 (f120, f122, f136, f144)
values ('a', 'Test 3.5.8.5-case', 5, 7);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 A*seven
Insert into tb3 (f120, f122, f136, f144)
values ('b', 'Test 3.5.8.5-case', 71,16);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 B*0000000016
B Test 3.5.8.5-case 00191 0000000016 B*0000000016
Insert into tb3 (f120, f122, f136, f144)
values ('c', 'Test 3.5.8.5-case', 80,1);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 C=one
B Test 3.5.8.5-case 00191 0000000016 C=one
......@@ -366,7 +366,7 @@ values ('d', 'Test 3.5.8.5-case', 152);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1*0000099999
A Test 3.5.8.5-case 00125 0000000007 1*0000099999
......@@ -377,7 +377,7 @@ values ('e', 'Test 3.5.8.5-case', 200, 8);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1=eight
1 Test 3.5.8.5-case 00200 0000000008 1=eight
......@@ -387,7 +387,7 @@ C Test 3.5.8.5-case 00200 0000000001 1=eight
Insert into tb3 (f120, f122, f136, f144)
values ('f', 'Test 3.5.8.5-case', 100, 8);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1=eight
1 Test 3.5.8.5-case 00200 0000000008 1=eight
......@@ -499,9 +499,38 @@ drop trigger trg7;
Testcase 3.5.8.6: (requirement void)
------------------------------------
CREATE PROCEDURE sp_01 () BEGIN set @v1=1; END//
CREATE TRIGGER trg8_1 BEFORE UPDATE ON tb3 FOR EACH ROW
BEGIN
CALL sp_01 ();
END//
Insert into tb3 (f120, f122, f136) values ('6', 'Test 3.5.8.6-insert', 101);
update tb3 set f120='S', f136=111,
f122='Test 3.5.8.6-tr8_1'
where f122='Test 3.5.8.6-insert';
select f120, f122
from tb3 where f122 like 'Test 3.5.8.6%' order by f120;
f120 f122
S Test 3.5.8.6-tr8_1
DROP TRIGGER trg8_1;
DROP PROCEDURE sp_01;
Testcase 3.5.8.7: (Disabled as a result of bug _____)
-----------------------------------------------------
Testcase 3.5.8.7
----------------
Create trigger trg9_1 before update on tb3 for each row
BEGIN
Start transaction;
Set new.f120='U';
Commit;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
Create trigger trg9_2 before delete on tb3 for each row
BEGIN
Start transaction;
Set @var2=old.f120;
Rollback;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
......@@ -294,8 +294,8 @@ drop table t2;
drop table t3;
drop table t4;
Testcase y.y.y.4: Recursive trigger/SP references (disabled bug 11889)
----------------------------------------------------------------------
Testcase y.y.y.4: Recursive trigger/SP references
-------------------------------------------------
set @sql_mode='traditional';
create table t1_sp (
count integer,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -58,6 +58,7 @@ load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11;
Section 3.1.10 - CALL checks:
--------------------------------------------------------------------------------
USE db_storedproc;
Testcase 3.1.10.2 + 3.1.10.5:
-----------------------------
......@@ -94,6 +95,7 @@ CALL sp31102();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102'
SELECT fn31105( 9 );
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105'
connection default;
USE db_storedproc;
root@localhost db_storedproc
......@@ -114,6 +116,7 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
connection default;
USE db_storedproc;
root@localhost db_storedproc
......@@ -180,6 +183,8 @@ DROP PROCEDURE IF EXISTS sp_ins_1;
DROP PROCEDURE IF EXISTS sp_ins_3;
DROP PROCEDURE IF EXISTS sp_upd;
DROP PROCEDURE IF EXISTS sp_ins_upd;
DROP PROCEDURE IF EXISTS sp_del;
DROP PROCEDURE IF EXISTS sp_with_rowcount;
CREATE TABLE temp(f1 CHAR(20),f2 CHAR(25),f3 DATE,f4 INT,f5 CHAR(25),f6 INT);
INSERT INTO temp SELECT * FROM t10;
CREATE PROCEDURE sp_ins_1()
......@@ -207,49 +212,72 @@ END;
SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1;
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc';
END//
CREATE PROCEDURE sp_del()
BEGIN
DELETE FROM temp WHERE temp.f1 ='qwe' OR temp.f1 = 'updated_2';
END//
CREATE PROCEDURE sp_with_rowcount()
BEGIN
BEGIN
INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000),
('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000),
('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000),
('qwe', 'xyz', '2005-11-07', 100, 'uvw', 1000);
END;
SELECT row_count() AS 'row_count() after insert';
SELECT row_count() AS 'row_count() after select row_count()';
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f2 = 'abc';
SELECT row_count() AS 'row_count() after update';
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
DELETE FROM temp WHERE temp.f1 = 'updated_2';
SELECT row_count() AS 'row_count() after delete';
END//
CALL sp_ins_1();
SELECT row_count();
row_count()
1
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
abc abc 2005-10-03 100 uvw 1000
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
abc abc 2005-10-03 100 uvw 1000
CALL sp_ins_3();
SELECT row_count();
row_count()
1
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
abc abc 2005-10-03 100 uvw 1000
abc xyz 1949-05-23 100 uvw 1000
abc xyz 1989-11-09 100 uvw 1000
abc xyz 2005-10-24 100 uvw 1000
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
abc abc 2005-10-03 100 uvw 1000
abc xyz 1949-05-23 100 uvw 1000
abc xyz 1989-11-09 100 uvw 1000
abc xyz 2005-10-24 100 uvw 1000
CALL sp_upd();
SELECT row_count();
row_count()
4
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
......@@ -258,8 +286,6 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
......@@ -281,8 +307,10 @@ COUNT( f1 ) f1
SELECT row_count();
row_count()
3
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
......@@ -291,20 +319,67 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
qwe xyz 1998-03-26 100 uvw 1000
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
updated xyz 2005-10-24 100 uvw 1000
updated_2 abc 1989-11-09 100 uvw 1000
qwe xyz 1998-03-26 100 uvw 1000
updated_2 abc 2000-11-09 100 uvw 1000
updated_2 abc 2005-11-07 100 uvw 1000
CALL sp_del();
SELECT row_count();
row_count()
4
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
updated xyz 2005-10-24 100 uvw 1000
DELETE FROM temp;
CALL sp_with_rowcount();
row_count() after insert
4
row_count() after select row_count()
-1
f1 f2 f3
qwe abc 1989-11-09
qwe abc 2000-11-09
qwe xyz 1998-03-26
qwe xyz 2005-11-07
row_count() after update
2
f1 f2 f3
qwe xyz 1998-03-26
qwe xyz 2005-11-07
updated_2 abc 1989-11-09
updated_2 abc 2000-11-09
row_count() after delete
2
SELECT row_count();
row_count()
-1
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
qwe xyz 1998-03-26 100 uvw 1000
qwe xyz 2005-11-07 100 uvw 1000
DROP PROCEDURE sp_ins_1;
DROP PROCEDURE sp_ins_3;
DROP PROCEDURE sp_upd;
DROP PROCEDURE sp_ins_upd;
DROP PROCEDURE sp_del;
DROP PROCEDURE sp_with_rowcount;
DROP TABLE temp;
Testcase 3.1.10.8:
......
......@@ -180,15 +180,14 @@ insert 3.5.3.2-no
insert 3.5.3.6-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4a_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1a';
insert into t1 (f1) values ('insert 3.5.3.7-1a');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
drop trigger trg4a_1;
......@@ -206,7 +205,6 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
......@@ -235,29 +233,27 @@ Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4b_1 before UPDATE on t1 for each row
set new.f1 = 'trig 3.5.3.7-1b';
insert into t1 (f1) values ('insert 3.5.3.7-1b');
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b';
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update 3.5.3.7-1b
drop trigger trg4b_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -271,23 +267,21 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
insert 3.5.3.7-2b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update 3.5.3.7-1b
update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b';
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
update 3.5.3.7-1b
drop trigger trg4b_2;
Testcase 3.5.3.7c
......@@ -313,21 +307,19 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4c_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1c';
insert into t1 (f1) values ('insert 3.5.3.7-1c');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
update 3.5.3.7-1b
drop trigger trg4c_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -341,14 +333,12 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
update 3.5.3.7-1b
drop trigger trg4c_2;
Testcase 3.5.3.7d:
......@@ -372,23 +362,20 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4d_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1d';
insert into t1 (f1) values ('insert 3.5.3.7-1d');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1d
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
update 3.5.3.7-1b
drop trigger trg4d_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -402,16 +389,13 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1d
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
trig 3.5.3.7-2d
update 3.5.3.7-1b
drop trigger trg4d_2;
Testcase 3.5.3.8a:
......@@ -436,14 +420,14 @@ use priv_db;
show grants;
Grants for test_noprivs@localhost
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5a_1 before INSERT on t1 for each row
set @test_var = new.f1;
set @test_var = 'before trig 3.5.3.8-1a';
select @test_var;
@test_var
before trig 3.5.3.8-1a
insert into t1 (f1) values ('insert 3.5.3.8-1a');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1a
......@@ -491,15 +475,15 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5b_1 before UPDATE on t1 for each row
set @test_var= new.f1;
set @test_var= 'before trig 3.5.3.8-1b';
insert into t1 (f1) values ('insert 3.5.3.8-1b');
select @test_var;
@test_var
before trig 3.5.3.8-1b
update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b';
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1b
......@@ -546,11 +530,11 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5c_1 before INSERT on t1 for each row
set @test_var= new.f1;
set @test_var= 'before trig 3.5.3.8-1c';
insert into t1 (f1) values ('insert 3.5.3.8-1c');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1c
......@@ -592,11 +576,11 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5d_1 before INSERT on t1 for each row
set @test_var= new.f1;
set @test_var='before trig 3.5.3.8-1d';
insert into t1 (f1) values ('insert 3.5.3.8-1d');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1d
......
......@@ -135,10 +135,10 @@ values ('1', 'Test 3.5.8.4', 222, 23456, 1.05);
Select f120, f122, f136, f144, f163 from tb3 where f122= 'Test 3.5.8.4';
f120 f122 f136 f144 f163
1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000
select * from db_test.t1_i order by i120;
select * from db_test.t1_i;
i120 i136 i144 i163
1 00222 0000023456 1.050000000000000000000000000000
select * from db_test.t1_u order by u120;
select * from db_test.t1_u;
u120 u136 u144 u163
a 00111 0000099999 999.990000000000000000000000000000
b 00222 0000023456 1.050000000000000000000000000000
......@@ -146,7 +146,7 @@ c 00333 0000099999 999.990000000000000000000000000000
d 00222 0000023456 1.050000000000000000000000000000
e 00222 0000023456 1.050000000000000000000000000000
f 00333 0000099999 999.990000000000000000000000000000
select * from db_test.t1_d order by d120;
select * from db_test.t1_d;
d120 d136 d144 d163
a 00111 0000099999 999.990000000000000000000000000000
c 00333 0000099999 999.990000000000000000000000000000
......@@ -339,20 +339,20 @@ set @test_var='Empty';
Insert into tb3 (f120, f122, f136, f144)
values ('a', 'Test 3.5.8.5-case', 5, 7);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 A*seven
Insert into tb3 (f120, f122, f136, f144)
values ('b', 'Test 3.5.8.5-case', 71,16);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 B*0000000016
B Test 3.5.8.5-case 00191 0000000016 B*0000000016
Insert into tb3 (f120, f122, f136, f144)
values ('c', 'Test 3.5.8.5-case', 80,1);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 C=one
B Test 3.5.8.5-case 00191 0000000016 C=one
......@@ -362,7 +362,7 @@ values ('d', 'Test 3.5.8.5-case', 152);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1*0000099999
A Test 3.5.8.5-case 00125 0000000007 1*0000099999
......@@ -373,7 +373,7 @@ values ('e', 'Test 3.5.8.5-case', 200, 8);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1=eight
1 Test 3.5.8.5-case 00200 0000000008 1=eight
......@@ -383,7 +383,7 @@ C Test 3.5.8.5-case 00200 0000000001 1=eight
Insert into tb3 (f120, f122, f136, f144)
values ('f', 'Test 3.5.8.5-case', 100, 8);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1=eight
1 Test 3.5.8.5-case 00200 0000000008 1=eight
......@@ -495,9 +495,38 @@ drop trigger trg7;
Testcase 3.5.8.6: (requirement void)
------------------------------------
CREATE PROCEDURE sp_01 () BEGIN set @v1=1; END//
CREATE TRIGGER trg8_1 BEFORE UPDATE ON tb3 FOR EACH ROW
BEGIN
CALL sp_01 ();
END//
Insert into tb3 (f120, f122, f136) values ('6', 'Test 3.5.8.6-insert', 101);
update tb3 set f120='S', f136=111,
f122='Test 3.5.8.6-tr8_1'
where f122='Test 3.5.8.6-insert';
select f120, f122
from tb3 where f122 like 'Test 3.5.8.6%' order by f120;
f120 f122
S Test 3.5.8.6-tr8_1
DROP TRIGGER trg8_1;
DROP PROCEDURE sp_01;
Testcase 3.5.8.7: (Disabled as a result of bug _____)
-----------------------------------------------------
Testcase 3.5.8.7
----------------
Create trigger trg9_1 before update on tb3 for each row
BEGIN
Start transaction;
Set new.f120='U';
Commit;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
Create trigger trg9_2 before delete on tb3 for each row
BEGIN
Start transaction;
Set @var2=old.f120;
Rollback;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
......@@ -294,8 +294,8 @@ drop table t2;
drop table t3;
drop table t4;
Testcase y.y.y.4: Recursive trigger/SP references (disabled bug 11889)
----------------------------------------------------------------------
Testcase y.y.y.4: Recursive trigger/SP references
-------------------------------------------------
set @sql_mode='traditional';
create table t1_sp (
count integer,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -58,6 +58,7 @@ load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11;
Section 3.1.10 - CALL checks:
--------------------------------------------------------------------------------
USE db_storedproc;
Testcase 3.1.10.2 + 3.1.10.5:
-----------------------------
......@@ -94,6 +95,7 @@ CALL sp31102();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102'
SELECT fn31105( 9 );
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105'
connection default;
USE db_storedproc;
root@localhost db_storedproc
......@@ -114,6 +116,7 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
connection default;
USE db_storedproc;
root@localhost db_storedproc
......@@ -180,6 +183,8 @@ DROP PROCEDURE IF EXISTS sp_ins_1;
DROP PROCEDURE IF EXISTS sp_ins_3;
DROP PROCEDURE IF EXISTS sp_upd;
DROP PROCEDURE IF EXISTS sp_ins_upd;
DROP PROCEDURE IF EXISTS sp_del;
DROP PROCEDURE IF EXISTS sp_with_rowcount;
CREATE TABLE temp(f1 CHAR(20),f2 CHAR(25),f3 DATE,f4 INT,f5 CHAR(25),f6 INT);
INSERT INTO temp SELECT * FROM t10;
CREATE PROCEDURE sp_ins_1()
......@@ -207,49 +212,72 @@ END;
SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1;
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc';
END//
CREATE PROCEDURE sp_del()
BEGIN
DELETE FROM temp WHERE temp.f1 ='qwe' OR temp.f1 = 'updated_2';
END//
CREATE PROCEDURE sp_with_rowcount()
BEGIN
BEGIN
INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000),
('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000),
('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000),
('qwe', 'xyz', '2005-11-07', 100, 'uvw', 1000);
END;
SELECT row_count() AS 'row_count() after insert';
SELECT row_count() AS 'row_count() after select row_count()';
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f2 = 'abc';
SELECT row_count() AS 'row_count() after update';
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
DELETE FROM temp WHERE temp.f1 = 'updated_2';
SELECT row_count() AS 'row_count() after delete';
END//
CALL sp_ins_1();
SELECT row_count();
row_count()
1
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
abc abc 2005-10-03 100 uvw 1000
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
abc abc 2005-10-03 100 uvw 1000
CALL sp_ins_3();
SELECT row_count();
row_count()
1
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
abc abc 2005-10-03 100 uvw 1000
abc xyz 1949-05-23 100 uvw 1000
abc xyz 1989-11-09 100 uvw 1000
abc xyz 2005-10-24 100 uvw 1000
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
abc abc 2005-10-03 100 uvw 1000
abc xyz 1949-05-23 100 uvw 1000
abc xyz 1989-11-09 100 uvw 1000
abc xyz 2005-10-24 100 uvw 1000
CALL sp_upd();
SELECT row_count();
row_count()
4
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
......@@ -258,8 +286,6 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
......@@ -281,8 +307,10 @@ COUNT( f1 ) f1
SELECT row_count();
row_count()
3
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
......@@ -291,20 +319,67 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
qwe xyz 1998-03-26 100 uvw 1000
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
updated xyz 2005-10-24 100 uvw 1000
updated_2 abc 1989-11-09 100 uvw 1000
qwe xyz 1998-03-26 100 uvw 1000
updated_2 abc 2000-11-09 100 uvw 1000
updated_2 abc 2005-11-07 100 uvw 1000
CALL sp_del();
SELECT row_count();
row_count()
4
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
updated xyz 2005-10-24 100 uvw 1000
DELETE FROM temp;
CALL sp_with_rowcount();
row_count() after insert
4
row_count() after select row_count()
-1
f1 f2 f3
qwe abc 1989-11-09
qwe abc 2000-11-09
qwe xyz 1998-03-26
qwe xyz 2005-11-07
row_count() after update
2
f1 f2 f3
qwe xyz 1998-03-26
qwe xyz 2005-11-07
updated_2 abc 1989-11-09
updated_2 abc 2000-11-09
row_count() after delete
2
SELECT row_count();
row_count()
-1
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
qwe xyz 1998-03-26 100 uvw 1000
qwe xyz 2005-11-07 100 uvw 1000
DROP PROCEDURE sp_ins_1;
DROP PROCEDURE sp_ins_3;
DROP PROCEDURE sp_upd;
DROP PROCEDURE sp_ins_upd;
DROP PROCEDURE sp_del;
DROP PROCEDURE sp_with_rowcount;
DROP TABLE temp;
Testcase 3.1.10.8:
......
......@@ -184,15 +184,14 @@ insert 3.5.3.2-no
insert 3.5.3.6-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4a_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1a';
insert into t1 (f1) values ('insert 3.5.3.7-1a');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
drop trigger trg4a_1;
......@@ -210,7 +209,6 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
......@@ -239,29 +237,27 @@ Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4b_1 before UPDATE on t1 for each row
set new.f1 = 'trig 3.5.3.7-1b';
insert into t1 (f1) values ('insert 3.5.3.7-1b');
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b';
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update 3.5.3.7-1b
drop trigger trg4b_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -275,23 +271,21 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
insert 3.5.3.7-2b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update 3.5.3.7-1b
update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b';
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
update 3.5.3.7-1b
drop trigger trg4b_2;
Testcase 3.5.3.7c
......@@ -317,21 +311,19 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4c_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1c';
insert into t1 (f1) values ('insert 3.5.3.7-1c');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
update 3.5.3.7-1b
drop trigger trg4c_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -345,14 +337,12 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
update 3.5.3.7-1b
drop trigger trg4c_2;
Testcase 3.5.3.7d:
......@@ -376,23 +366,20 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4d_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1d';
insert into t1 (f1) values ('insert 3.5.3.7-1d');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1d
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
update 3.5.3.7-1b
drop trigger trg4d_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -406,16 +393,13 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1d
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
trig 3.5.3.7-2d
update 3.5.3.7-1b
drop trigger trg4d_2;
Testcase 3.5.3.8a:
......@@ -440,14 +424,14 @@ use priv_db;
show grants;
Grants for test_noprivs@localhost
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5a_1 before INSERT on t1 for each row
set @test_var = new.f1;
set @test_var = 'before trig 3.5.3.8-1a';
select @test_var;
@test_var
before trig 3.5.3.8-1a
insert into t1 (f1) values ('insert 3.5.3.8-1a');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1a
......@@ -495,15 +479,15 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5b_1 before UPDATE on t1 for each row
set @test_var= new.f1;
set @test_var= 'before trig 3.5.3.8-1b';
insert into t1 (f1) values ('insert 3.5.3.8-1b');
select @test_var;
@test_var
before trig 3.5.3.8-1b
update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b';
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1b
......@@ -550,11 +534,11 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5c_1 before INSERT on t1 for each row
set @test_var= new.f1;
set @test_var= 'before trig 3.5.3.8-1c';
insert into t1 (f1) values ('insert 3.5.3.8-1c');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1c
......@@ -596,11 +580,11 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5d_1 before INSERT on t1 for each row
set @test_var= new.f1;
set @test_var='before trig 3.5.3.8-1d';
insert into t1 (f1) values ('insert 3.5.3.8-1d');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1d
......
......@@ -139,10 +139,10 @@ values ('1', 'Test 3.5.8.4', 222, 23456, 1.05);
Select f120, f122, f136, f144, f163 from tb3 where f122= 'Test 3.5.8.4';
f120 f122 f136 f144 f163
1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000
select * from db_test.t1_i order by i120;
select * from db_test.t1_i;
i120 i136 i144 i163
1 00222 0000023456 1.050000000000000000000000000000
select * from db_test.t1_u order by u120;
select * from db_test.t1_u;
u120 u136 u144 u163
a 00111 0000099999 999.990000000000000000000000000000
b 00222 0000023456 1.050000000000000000000000000000
......@@ -150,7 +150,7 @@ c 00333 0000099999 999.990000000000000000000000000000
d 00222 0000023456 1.050000000000000000000000000000
e 00222 0000023456 1.050000000000000000000000000000
f 00333 0000099999 999.990000000000000000000000000000
select * from db_test.t1_d order by d120;
select * from db_test.t1_d;
d120 d136 d144 d163
a 00111 0000099999 999.990000000000000000000000000000
c 00333 0000099999 999.990000000000000000000000000000
......@@ -343,20 +343,20 @@ set @test_var='Empty';
Insert into tb3 (f120, f122, f136, f144)
values ('a', 'Test 3.5.8.5-case', 5, 7);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 A*seven
Insert into tb3 (f120, f122, f136, f144)
values ('b', 'Test 3.5.8.5-case', 71,16);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 B*0000000016
B Test 3.5.8.5-case 00191 0000000016 B*0000000016
Insert into tb3 (f120, f122, f136, f144)
values ('c', 'Test 3.5.8.5-case', 80,1);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 C=one
B Test 3.5.8.5-case 00191 0000000016 C=one
......@@ -366,7 +366,7 @@ values ('d', 'Test 3.5.8.5-case', 152);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1*0000099999
A Test 3.5.8.5-case 00125 0000000007 1*0000099999
......@@ -377,7 +377,7 @@ values ('e', 'Test 3.5.8.5-case', 200, 8);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1=eight
1 Test 3.5.8.5-case 00200 0000000008 1=eight
......@@ -387,7 +387,7 @@ C Test 3.5.8.5-case 00200 0000000001 1=eight
Insert into tb3 (f120, f122, f136, f144)
values ('f', 'Test 3.5.8.5-case', 100, 8);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1=eight
1 Test 3.5.8.5-case 00200 0000000008 1=eight
......@@ -499,9 +499,38 @@ drop trigger trg7;
Testcase 3.5.8.6: (requirement void)
------------------------------------
CREATE PROCEDURE sp_01 () BEGIN set @v1=1; END//
CREATE TRIGGER trg8_1 BEFORE UPDATE ON tb3 FOR EACH ROW
BEGIN
CALL sp_01 ();
END//
Insert into tb3 (f120, f122, f136) values ('6', 'Test 3.5.8.6-insert', 101);
update tb3 set f120='S', f136=111,
f122='Test 3.5.8.6-tr8_1'
where f122='Test 3.5.8.6-insert';
select f120, f122
from tb3 where f122 like 'Test 3.5.8.6%' order by f120;
f120 f122
S Test 3.5.8.6-tr8_1
DROP TRIGGER trg8_1;
DROP PROCEDURE sp_01;
Testcase 3.5.8.7: (Disabled as a result of bug _____)
-----------------------------------------------------
Testcase 3.5.8.7
----------------
Create trigger trg9_1 before update on tb3 for each row
BEGIN
Start transaction;
Set new.f120='U';
Commit;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
Create trigger trg9_2 before delete on tb3 for each row
BEGIN
Start transaction;
Set @var2=old.f120;
Rollback;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
......@@ -298,8 +298,8 @@ drop table t2;
drop table t3;
drop table t4;
Testcase y.y.y.4: Recursive trigger/SP references (disabled bug 11889)
----------------------------------------------------------------------
Testcase y.y.y.4: Recursive trigger/SP references
-------------------------------------------------
set @sql_mode='traditional';
create table t1_sp (
count integer,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -58,6 +58,7 @@ load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11;
Section 3.1.10 - CALL checks:
--------------------------------------------------------------------------------
USE db_storedproc;
Testcase 3.1.10.2 + 3.1.10.5:
-----------------------------
......@@ -94,6 +95,7 @@ CALL sp31102();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102'
SELECT fn31105( 9 );
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105'
connection default;
USE db_storedproc;
root@localhost db_storedproc
......@@ -114,6 +116,7 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
connection default;
USE db_storedproc;
root@localhost db_storedproc
......@@ -180,6 +183,8 @@ DROP PROCEDURE IF EXISTS sp_ins_1;
DROP PROCEDURE IF EXISTS sp_ins_3;
DROP PROCEDURE IF EXISTS sp_upd;
DROP PROCEDURE IF EXISTS sp_ins_upd;
DROP PROCEDURE IF EXISTS sp_del;
DROP PROCEDURE IF EXISTS sp_with_rowcount;
CREATE TABLE temp(f1 CHAR(20),f2 CHAR(25),f3 DATE,f4 INT,f5 CHAR(25),f6 INT);
INSERT INTO temp SELECT * FROM t10;
CREATE PROCEDURE sp_ins_1()
......@@ -207,49 +212,72 @@ END;
SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1;
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc';
END//
CREATE PROCEDURE sp_del()
BEGIN
DELETE FROM temp WHERE temp.f1 ='qwe' OR temp.f1 = 'updated_2';
END//
CREATE PROCEDURE sp_with_rowcount()
BEGIN
BEGIN
INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000),
('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000),
('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000),
('qwe', 'xyz', '2005-11-07', 100, 'uvw', 1000);
END;
SELECT row_count() AS 'row_count() after insert';
SELECT row_count() AS 'row_count() after select row_count()';
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f2 = 'abc';
SELECT row_count() AS 'row_count() after update';
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
DELETE FROM temp WHERE temp.f1 = 'updated_2';
SELECT row_count() AS 'row_count() after delete';
END//
CALL sp_ins_1();
SELECT row_count();
row_count()
1
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
abc abc 2005-10-03 100 uvw 1000
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
abc abc 2005-10-03 100 uvw 1000
CALL sp_ins_3();
SELECT row_count();
row_count()
1
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
abc abc 2005-10-03 100 uvw 1000
abc xyz 1949-05-23 100 uvw 1000
abc xyz 1989-11-09 100 uvw 1000
abc xyz 2005-10-24 100 uvw 1000
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
abc abc 2005-10-03 100 uvw 1000
abc xyz 1949-05-23 100 uvw 1000
abc xyz 1989-11-09 100 uvw 1000
abc xyz 2005-10-24 100 uvw 1000
CALL sp_upd();
SELECT row_count();
row_count()
4
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
......@@ -258,8 +286,6 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
......@@ -281,8 +307,10 @@ COUNT( f1 ) f1
SELECT row_count();
row_count()
3
SELECT * FROM temp ORDER BY f4;
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
......@@ -291,20 +319,67 @@ adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
updated_2 abc 2000-11-09 100 uvw 1000
qwe xyz 1998-03-26 100 uvw 1000
updated_2 abc 1989-11-09 100 uvw 1000
updated xyz 2005-10-24 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
updated xyz 2005-10-24 100 uvw 1000
updated_2 abc 1989-11-09 100 uvw 1000
updated_2 abc 2000-11-09 100 uvw 1000
updated_2 abc 2005-11-07 100 uvw 1000
CALL sp_del();
SELECT row_count();
row_count()
4
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
a` a` 1000-01-01 -5000 a` -5000
aaa aaa 1000-01-02 -4999 aaa -4999
abaa abaa 1000-01-03 -4998 abaa -4998
acaaa acaaa 1000-01-04 -4997 acaaa -4997
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
updated abc 2005-10-03 100 uvw 1000
updated xyz 1949-05-23 100 uvw 1000
updated xyz 1989-11-09 100 uvw 1000
updated xyz 2005-10-24 100 uvw 1000
DELETE FROM temp;
CALL sp_with_rowcount();
row_count() after insert
4
row_count() after select row_count()
-1
f1 f2 f3
qwe abc 1989-11-09
qwe abc 2000-11-09
qwe xyz 1998-03-26
qwe xyz 2005-11-07
row_count() after update
2
f1 f2 f3
qwe xyz 1998-03-26
qwe xyz 2005-11-07
updated_2 abc 1989-11-09
updated_2 abc 2000-11-09
row_count() after delete
2
SELECT row_count();
row_count()
-1
SELECT * FROM temp;
f1 f2 f3 f4 f5 f6
qwe xyz 1998-03-26 100 uvw 1000
qwe xyz 2005-11-07 100 uvw 1000
DROP PROCEDURE sp_ins_1;
DROP PROCEDURE sp_ins_3;
DROP PROCEDURE sp_upd;
DROP PROCEDURE sp_ins_upd;
DROP PROCEDURE sp_del;
DROP PROCEDURE sp_with_rowcount;
DROP TABLE temp;
Testcase 3.1.10.8:
......
......@@ -185,15 +185,14 @@ insert 3.5.3.2-no
insert 3.5.3.6-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4a_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1a';
insert into t1 (f1) values ('insert 3.5.3.7-1a');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
drop trigger trg4a_1;
......@@ -211,7 +210,6 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
......@@ -240,29 +238,27 @@ Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4b_1 before UPDATE on t1 for each row
set new.f1 = 'trig 3.5.3.7-1b';
insert into t1 (f1) values ('insert 3.5.3.7-1b');
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b';
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update 3.5.3.7-1b
drop trigger trg4b_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -276,23 +272,21 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
insert 3.5.3.7-2b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
update 3.5.3.7-1b
update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b';
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
update 3.5.3.7-1b
drop trigger trg4b_2;
Testcase 3.5.3.7c
......@@ -318,21 +312,19 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4c_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1c';
insert into t1 (f1) values ('insert 3.5.3.7-1c');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
update 3.5.3.7-1b
drop trigger trg4c_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -346,14 +338,12 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
update 3.5.3.7-1b
drop trigger trg4c_2;
Testcase 3.5.3.7d:
......@@ -377,23 +367,20 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8884
------------------------------------------------
create trigger trg4d_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1d';
insert into t1 (f1) values ('insert 3.5.3.7-1d');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1d
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
update 3.5.3.7-1b
drop trigger trg4d_1;
show grants;
Grants for test_yesprivs@localhost
......@@ -407,16 +394,13 @@ select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
insert 3.5.3.6-no
insert 3.5.3.7-1a
insert 3.5.3.7-1c
insert 3.5.3.7-1d
insert 3.5.3.7-1b
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
trig 3.5.3.7-2d
update 3.5.3.7-1b
drop trigger trg4d_2;
Testcase 3.5.3.8a:
......@@ -441,14 +425,14 @@ use priv_db;
show grants;
Grants for test_noprivs@localhost
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5a_1 before INSERT on t1 for each row
set @test_var = new.f1;
set @test_var = 'before trig 3.5.3.8-1a';
select @test_var;
@test_var
before trig 3.5.3.8-1a
insert into t1 (f1) values ('insert 3.5.3.8-1a');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1a
......@@ -496,15 +480,15 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5b_1 before UPDATE on t1 for each row
set @test_var= new.f1;
set @test_var= 'before trig 3.5.3.8-1b';
insert into t1 (f1) values ('insert 3.5.3.8-1b');
select @test_var;
@test_var
before trig 3.5.3.8-1b
update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b';
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1b
......@@ -551,11 +535,11 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5c_1 before INSERT on t1 for each row
set @test_var= new.f1;
set @test_var= 'before trig 3.5.3.8-1c';
insert into t1 (f1) values ('insert 3.5.3.8-1c');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1c
......@@ -597,11 +581,11 @@ Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
Trigger create disabled - should fail - Bug 8887
------------------------------------------------
create trigger trg5d_1 before INSERT on t1 for each row
set @test_var= new.f1;
set @test_var='before trig 3.5.3.8-1d';
insert into t1 (f1) values ('insert 3.5.3.8-1d');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select @test_var;
@test_var
before trig 3.5.3.8-1d
......
......@@ -140,10 +140,10 @@ values ('1', 'Test 3.5.8.4', 222, 23456, 1.05);
Select f120, f122, f136, f144, f163 from tb3 where f122= 'Test 3.5.8.4';
f120 f122 f136 f144 f163
1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000
select * from db_test.t1_i order by i120;
select * from db_test.t1_i;
i120 i136 i144 i163
1 00222 0000023456 1.050000000000000000000000000000
select * from db_test.t1_u order by u120;
select * from db_test.t1_u;
u120 u136 u144 u163
a 00111 0000099999 999.990000000000000000000000000000
b 00222 0000023456 1.050000000000000000000000000000
......@@ -151,7 +151,7 @@ c 00333 0000099999 999.990000000000000000000000000000
d 00222 0000023456 1.050000000000000000000000000000
e 00222 0000023456 1.050000000000000000000000000000
f 00333 0000099999 999.990000000000000000000000000000
select * from db_test.t1_d order by d120;
select * from db_test.t1_d;
d120 d136 d144 d163
a 00111 0000099999 999.990000000000000000000000000000
c 00333 0000099999 999.990000000000000000000000000000
......@@ -344,20 +344,20 @@ set @test_var='Empty';
Insert into tb3 (f120, f122, f136, f144)
values ('a', 'Test 3.5.8.5-case', 5, 7);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 A*seven
Insert into tb3 (f120, f122, f136, f144)
values ('b', 'Test 3.5.8.5-case', 71,16);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 B*0000000016
B Test 3.5.8.5-case 00191 0000000016 B*0000000016
Insert into tb3 (f120, f122, f136, f144)
values ('c', 'Test 3.5.8.5-case', 80,1);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
A Test 3.5.8.5-case 00125 0000000007 C=one
B Test 3.5.8.5-case 00191 0000000016 C=one
......@@ -367,7 +367,7 @@ values ('d', 'Test 3.5.8.5-case', 152);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1*0000099999
A Test 3.5.8.5-case 00125 0000000007 1*0000099999
......@@ -378,7 +378,7 @@ values ('e', 'Test 3.5.8.5-case', 200, 8);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1=eight
1 Test 3.5.8.5-case 00200 0000000008 1=eight
......@@ -388,7 +388,7 @@ C Test 3.5.8.5-case 00200 0000000001 1=eight
Insert into tb3 (f120, f122, f136, f144)
values ('f', 'Test 3.5.8.5-case', 100, 8);
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120;
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
1 Test 3.5.8.5-case 00152 0000099999 1=eight
1 Test 3.5.8.5-case 00200 0000000008 1=eight
......@@ -500,9 +500,38 @@ drop trigger trg7;
Testcase 3.5.8.6: (requirement void)
------------------------------------
CREATE PROCEDURE sp_01 () BEGIN set @v1=1; END//
CREATE TRIGGER trg8_1 BEFORE UPDATE ON tb3 FOR EACH ROW
BEGIN
CALL sp_01 ();
END//
Insert into tb3 (f120, f122, f136) values ('6', 'Test 3.5.8.6-insert', 101);
update tb3 set f120='S', f136=111,
f122='Test 3.5.8.6-tr8_1'
where f122='Test 3.5.8.6-insert';
select f120, f122
from tb3 where f122 like 'Test 3.5.8.6%' order by f120;
f120 f122
S Test 3.5.8.6-tr8_1
DROP TRIGGER trg8_1;
DROP PROCEDURE sp_01;
Testcase 3.5.8.7: (Disabled as a result of bug _____)
-----------------------------------------------------
Testcase 3.5.8.7
----------------
Create trigger trg9_1 before update on tb3 for each row
BEGIN
Start transaction;
Set new.f120='U';
Commit;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
Create trigger trg9_2 before delete on tb3 for each row
BEGIN
Start transaction;
Set @var2=old.f120;
Rollback;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
......@@ -295,8 +295,8 @@ drop table t2;
drop table t3;
drop table t4;
Testcase y.y.y.4: Recursive trigger/SP references (disabled bug 11889)
----------------------------------------------------------------------
Testcase y.y.y.4: Recursive trigger/SP references
-------------------------------------------------
set @sql_mode='traditional';
create table t1_sp (
count integer,
......
This diff is collapsed.
......@@ -21,6 +21,7 @@ let $message= Section 3.1.10 - CALL checks:;
--source include/show_msg80.inc
USE db_storedproc;
# ------------------------------------------------------------------------------
let $message= Testcase 3.1.10.2 + 3.1.10.5:;
......@@ -73,11 +74,12 @@ connect (user2_2, localhost, user_2, , db_storedproc);
--source suite/funcs_1/include/show_connection.inc
# no privileges exist
--error 1370
--error ER_PROCACCESS_DENIED_ERROR
CALL sp31102();
SELECT fn31105( 9 );
# now 'add' EXECUTE to INVOKER
--echo connection default;
connection default;
USE db_storedproc;
--source suite/funcs_1/include/show_connection.inc
......@@ -97,6 +99,7 @@ SELECT fn31105( 9 );
disconnect user2_3;
# now 'remove' SELECT from INVOKER
--echo connection default;
connection default;
USE db_storedproc;
--source suite/funcs_1/include/show_connection.inc
......@@ -144,7 +147,7 @@ BEGIN
END//
delimiter ;//
--error 1305
--error ER_SP_DOES_NOT_EXIST
CALL fn1();
# cleanup
......@@ -170,7 +173,7 @@ BEGIN
END//
delimiter ;//
--error 1305
--error ER_SP_DOES_NOT_EXIST
SELECT sp1();
# cleanup
......@@ -184,26 +187,32 @@ let $message=
Ensure that the ROW_COUNT() SQL function always returns the correct number of
rows affected by the execution of a stored procedure.;
--source include/show_msg80.inc
# Note(mleich): Information taken from a comments in
# Bug#21818 Return value of ROW_COUNT() is incorrect for
# ALTER TABLE, LOAD DATA
# ROW_COUNT() is -1 following any statement which is not DELETE, INSERT
# or UPDATE.
# Also, after a CALL statement, ROW_COUNT() will return the value of the
# last statement in the stored procedure.
--disable_warnings
DROP PROCEDURE IF EXISTS sp_ins_1;
DROP PROCEDURE IF EXISTS sp_ins_3;
DROP PROCEDURE IF EXISTS sp_upd;
DROP PROCEDURE IF EXISTS sp_ins_upd;
DROP PROCEDURE IF EXISTS sp_del;
DROP PROCEDURE IF EXISTS sp_with_rowcount;
--enable_warnings
CREATE TABLE temp(f1 CHAR(20),f2 CHAR(25),f3 DATE,f4 INT,f5 CHAR(25),f6 INT);
INSERT INTO temp SELECT * FROM t10;
delimiter //;
#FIXME: add to proc: SELECT row_count() 'ins';
CREATE PROCEDURE sp_ins_1()
BEGIN
INSERT INTO temp VALUES ('abc', 'abc', '20051003', 100, 'uvw', 1000);
END//
#FIXME: add to proc: SELECT row_count() 'ins_3';
CREATE PROCEDURE sp_ins_3()
BEGIN
INSERT INTO temp VALUES ('abc', 'xyz', '19490523', 100, 'uvw', 1000);
......@@ -211,26 +220,11 @@ BEGIN
INSERT INTO temp VALUES ('abc', 'xyz', '2005-10-24', 100, 'uvw', 1000);
END//
# FIXME: add to proc: SELECT row_count() AS 'updated';
CREATE PROCEDURE sp_upd()
BEGIN
UPDATE temp SET temp.f1 = 'updated' WHERE temp.f1 ='abc';
END//
# FIXME: use commented proc
# CREATE PROCEDURE sp_ins_upd()
# BEGIN
# BEGIN
# INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000);
# INSERT INTO temp VALUES ('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000);
# INSERT INTO temp VALUES ('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000);
# INSERT INTO temp VALUES ('qwe', 'abc', '2005-11-07', 100, 'uvw', 1000);
# END;
# SELECT row_count() AS 'insert "qwe"';
# SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1;
# UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc';
# SELECT row_count() AS 'update "qwe" AND "abc"';
# END//
CREATE PROCEDURE sp_ins_upd()
BEGIN
BEGIN
......@@ -242,31 +236,70 @@ BEGIN
SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1;
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc';
END//
CREATE PROCEDURE sp_del()
BEGIN
DELETE FROM temp WHERE temp.f1 ='qwe' OR temp.f1 = 'updated_2';
END//
CREATE PROCEDURE sp_with_rowcount()
BEGIN
BEGIN
INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000),
('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000),
('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000),
('qwe', 'xyz', '2005-11-07', 100, 'uvw', 1000);
END;
SELECT row_count() AS 'row_count() after insert';
SELECT row_count() AS 'row_count() after select row_count()';
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f2 = 'abc';
SELECT row_count() AS 'row_count() after update';
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
DELETE FROM temp WHERE temp.f1 = 'updated_2';
SELECT row_count() AS 'row_count() after delete';
END//
delimiter ;//
CALL sp_ins_1();
SELECT row_count();
SELECT * FROM temp ORDER BY f4;
--sorted_result
SELECT * FROM temp;
CALL sp_ins_3();
#FIXME: check is 1 correct here? I expect 3 for 3 inserted rows inside the procedure
SELECT row_count();
SELECT * FROM temp ORDER BY f4;
--sorted_result
SELECT * FROM temp;
CALL sp_upd();
SELECT row_count();
SELECT * FROM temp ORDER BY f4;
--sorted_result
SELECT * FROM temp;
#FIXME: check is 3 correct here? I expect 7 for 4 inserted and then 3 updated rows inside the procedure
CALL sp_ins_upd();
SELECT row_count();
SELECT * FROM temp ORDER BY f4;
--sorted_result
SELECT * FROM temp;
CALL sp_del();
SELECT row_count();
--sorted_result
SELECT * FROM temp;
DELETE FROM temp;
CALL sp_with_rowcount();
SELECT row_count();
--sorted_result
SELECT * FROM temp;
# cleanup
DROP PROCEDURE sp_ins_1;
DROP PROCEDURE sp_ins_3;
DROP PROCEDURE sp_upd;
DROP PROCEDURE sp_ins_upd;
DROP PROCEDURE sp_del;
DROP PROCEDURE sp_with_rowcount;
DROP TABLE temp;
......
......@@ -10,7 +10,8 @@
#
##############################################################################
innodb_storedproc: (changes of WL#2984, using storeproc_nn instead)
memory_storedproc: (changes of WL#2984, using storeproc_nn instead)
myisam_storedproc: (changes of WL#2984, using storeproc_nn instead)
innodb_storedproc_06 : bug#33464 DROP FUNCTION let server hang
myisam_storedproc_06 : bug#33464 DROP FUNCTION let server hang
memory_storedproc_06 : bug#33464 DROP FUNCTION let server hang
ndb_storedproc_06 : bug#33464 DROP FUNCTION let server hang
ndb__datadict: 2007-10-08 mleich Bug#31421 funcs_1: ndb__datadict fails, discrepancy between scripts and expected results
......@@ -18,11 +18,9 @@ let $engine_type= innodb;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/innodb_tb1.inc
......@@ -41,7 +39,5 @@ while ($run)
# These tables are needed for the stored procedure testscases
--source suite/funcs_1/include/sp_tb.inc
let $run= 0;
}
......@@ -18,16 +18,12 @@ let $engine_type= innodb;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/innodb_tb4.inc
let $run= 0;
}
--source suite/funcs_1/bitdata/bitdata_master.test
......
......@@ -18,16 +18,12 @@ let $engine_type= innodb;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/innodb_tb1.inc
let $run= 0;
}
--source suite/funcs_1/cursors/cursors_master.test
......
#### suite/funcs_1/t/innodb_storedproc.test
#
--source include/have_innodb.inc
let $engine_type= innodb;
--source suite/funcs_1/storedproc/load_sp_tb.inc
--source suite/funcs_1/storedproc/storedproc_master.inc
......@@ -18,16 +18,12 @@ let $engine_type= innodb;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/innodb_tb3.inc
let $run= 0;
}
--source suite/funcs_1/triggers/triggers_0102.inc
......
......@@ -18,16 +18,12 @@ let $engine_type= innodb;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/innodb_tb3.inc
let $run= 0;
}
--source suite/funcs_1/triggers/triggers_03.inc
......
......@@ -18,14 +18,11 @@ let $engine_type= innodb;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
let $run= 0;
}
--source suite/funcs_1/triggers/triggers_03e_db_level.inc
......
......@@ -18,16 +18,12 @@ let $engine_type= innodb;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/innodb_tb3.inc
let $run= 0;
}
--source suite/funcs_1/triggers/triggers_0407.inc
......
......@@ -18,16 +18,12 @@ let $engine_type= innodb;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/innodb_tb3.inc
let $run= 0;
}
--source suite/funcs_1/triggers/triggers_08.inc
......
......@@ -18,16 +18,12 @@ let $engine_type= innodb;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/innodb_tb3.inc
let $run= 0;
}
--source suite/funcs_1/triggers/triggers_09.inc
......
......@@ -18,16 +18,12 @@ let $engine_type= innodb;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/innodb_tb3.inc
let $run= 0;
}
--source suite/funcs_1/triggers/triggers_1011ext.inc
......
......@@ -18,16 +18,12 @@ let $engine_type= innodb;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/innodb_tb3.inc
let $run= 0;
}
--source suite/funcs_1/triggers/trig_frkey.inc
......
......@@ -21,7 +21,6 @@ eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
let $run= `SELECT @NO_REFRESH = 0`;
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/innodb_tb2.inc
......@@ -32,7 +31,6 @@ if ($run)
USE test1;
--source suite/funcs_1/include/innodb_tb2.inc
USE test;
}
--source suite/funcs_1/views/views_master.inc
......
......@@ -16,11 +16,9 @@ let $engine_type= memory;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/memory_tb1.inc
......@@ -39,7 +37,5 @@ while ($run)
# These tables are needed for the stored procedure testscases
--source suite/funcs_1/include/sp_tb.inc
let $run= 0;
}
......@@ -16,16 +16,12 @@ let $engine_type= memory;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/memory_tb4.inc
let $run= 0;
}
--source suite/funcs_1/bitdata/bitdata_master.test
......
......@@ -16,16 +16,12 @@ let $engine_type= memory;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/memory_tb1.inc
let $run= 0;
}
--source suite/funcs_1/cursors/cursors_master.test
......
......@@ -3,4 +3,6 @@
let $engine_type= memory;
--source suite/funcs_1/storedproc/load_sp_tb.inc
--source suite/funcs_1/storedproc/storedproc_master.inc
......@@ -16,16 +16,12 @@ let $engine_type= memory;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/memory_tb3.inc
let $run= 0;
}
--source suite/funcs_1/triggers/triggers_0102.inc
......
......@@ -16,16 +16,12 @@ let $engine_type= memory;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/memory_tb3.inc
let $run= 0;
}
--source suite/funcs_1/triggers/triggers_03.inc
......
......@@ -16,14 +16,11 @@ let $engine_type= memory;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
let $run= 0;
}
--source suite/funcs_1/triggers/triggers_03e_db_level.inc
......
......@@ -16,16 +16,12 @@ let $engine_type= memory;
eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1);
# FIXME Replace the following, when "if" for mysqltest is available
let $run= `SELECT @NO_REFRESH = 0`;
while ($run)
if ($run)
{
# Create some objects needed in many testcases
USE test;
--source suite/funcs_1/include/memory_tb3.inc
let $run= 0;
}
--source suite/funcs_1/triggers/triggers_0407.inc
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment