Commit graph

148 commits

Author SHA1 Message Date
malff/marcsql@weblab.(none)
e677c6e70f Manual merge from 5.0-runtime to 5.1-runtime 2007-03-14 17:38:06 -06:00
kroki/tomash@moonlight.home
7bbea96754 Merge moonlight.home:/home/tomash/src/mysql_ab/mysql-5.1
into  moonlight.home:/home/tomash/src/mysql_ab/mysql-5.1-bug9953
2007-03-09 13:17:46 +03:00
kroki/tomash@moonlight.home
c19affef54 BUG#9953: CONVERT_TZ requires mysql.time_zone_name to be locked
The problem was that some facilities (like CONVERT_TZ() function or
server HELP statement) may require implicit access to some tables in
'mysql' database.  This access was done by ordinary means of adding
such tables to the list of tables the query is going to open.
However, if we issued LOCK TABLES before that, we would get "table
was not locked" error trying to open such implicit tables.

The solution is to treat certain tables as MySQL system tables, like
we already do for mysql.proc.  Such tables may be opened for reading
at any moment regardless of any locks in effect.  The cost of this is
that system table may be locked for writing only together with other
system tables, it is disallowed to lock system tables for writing and
have any other lock on any other table.

After this patch the following tables are treated as MySQL system
tables:
  mysql.help_category
  mysql.help_keyword
  mysql.help_relation
  mysql.help_topic
  mysql.proc (it already was)
  mysql.time_zone
  mysql.time_zone_leap_second
  mysql.time_zone_name
  mysql.time_zone_transition
  mysql.time_zone_transition_type

These tables are now opened with open_system_tables_for_read() and
closed with close_system_tables(), or one table may be opened with
open_system_table_for_update() and closed with close_thread_tables()
(the latter is used for mysql.proc table, which is updated as part of
normal MySQL server operation).  These functions may be used when
some tables were opened and locked already.

NOTE: online update of time zone tables is not possible during
replication, because there's no time zone cache flush neither on LOCK
TABLES, nor on FLUSH TABLES, so the master may serve stale time zone
data from cache, while on slave updated data will be loaded from the
time zone tables.
2007-03-09 13:12:31 +03:00
malff/marcsql@weblab.(none)
fedd1ae771 Manual merge 2007-03-06 13:46:33 -07:00
dlenev@mockturtle.local
282501df21 Merge mockturtle.local:/home/dlenev/src/mysql-5.0-bg24491
into  mockturtle.local:/home/dlenev/src/mysql-5.1-bg24491
2007-01-24 10:42:57 +03:00
dlenev@mockturtle.local
2b63f10601 Proposed fix for bug#24491 "using alias from source table in insert ...
on duplicate key".

INSERT ... SELECT ... ON DUPLICATE KEY UPDATE which was used in
stored routine or as prepared statement and which in its ON DUPLICATE
KEY clause erroneously tried to assign value to a column mentioned only
in its SELECT part was properly emitting error on the first execution
but succeeded on the second and following executions.

Code which is responsible for name resolution of fields mentioned in
UPDATE clause (e.g. see select_insert::prepare()) modifies table list
and Name_resolution_context used in this process. It uses
Name_resolution_context_state::save_state/restore_state() to revert
these modifications. Unfortunately those two methods failed to revert
properly modifications to TABLE_LIST::next_name_resolution_table
and this broke name resolution process for successive executions.

This patch fixes Name_resolution_context_state::save_state/restore_state()
in such way that it properly handles TABLE_LIST::next_name_resolution_table.
2007-01-23 15:03:48 +03:00
kroki/tomash@moonlight.intranet
9e942999d6 Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0
into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug20953
2006-10-12 18:33:07 +04:00
kroki/tomash@moonlight.intranet
160f5fa519 Fix after manual merge. 2006-10-12 18:30:59 +04:00
kroki/tomash@moonlight.intranet
813431e9c9 Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug20953
into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.1-bug20953
2006-10-12 18:06:26 +04:00
kroki/tomash@moonlight.intranet
591c06d4b7 BUG#20953: create proc with a create view that uses local vars/params
should fail to create

The problem was that this type of errors was checked during view
creation, which doesn't happen when CREATE VIEW is a statement of
a created stored routine.

The solution is to perform the checks at parse time.  The idea of the
fix is that the parser checks if a construction just parsed is allowed
in current circumstances by testing certain flags, and this flags are
reset for VIEWs.

The side effect of this change is that if the user already have
such bogus routines, it will now get a error when trying to do

  SHOW CREATE PROCEDURE proc;

(and some other) and when trying to execute such routine he will get

  ERROR 1457 (HY000): Failed to load routine test.p5. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)

However there should be very few such users (if any), and they may
(and should) drop these bogus routines.
2006-10-12 18:02:57 +04:00
kostja@bodhi.local
ebb7070430 Merge bodhi.local:/opt/local/work/mysql-5.0-runtime-safemerge
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2006-08-30 03:00:19 +04:00
andrey@example.com
f115ecf89f Fix for bug#21795: SP: sp_head::is_not_allowed_in_function() contains
erroneous check

Problem: Actually there were two problems in the server code. The check
for SQLCOM_FLUSH in SF/Triggers were not according to the existing
architecture which uses sp_get_flags_for_command() from sp_head.cc .
This function was also missing a check for SQLCOM_FLUSH which has a
problem combined with prelocking. This changeset fixes both of these
deficiencies as well as the erroneous check in
sp_head::is_not_allowed_in_function() which was a copy&paste error.
2006-08-25 15:51:29 +02:00
kostja@bodhi.local
5dfdc8bfce Manual merge 5.0->5.1. Post-merge fixes. 2006-08-14 13:27:11 +04:00
kostja@bodhi.local
04c97488f9 Merge bodhi.local:/opt/local/work/tmp_merge
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2006-08-12 21:06:51 +04:00
andrey@lmy004.
76ff7fb78f Fix for bug#20701 BINARY keyword should be forbidden in stored routines
create function func() returns char(10) binary ...
is no more possible. This will be reenabled when 
bug 2676 "DECLARE can't have COLLATE clause in stored procedure"
is fixed.

Fix after 2nd review
2006-08-09 17:07:59 +02:00
msvensson@shellback.(none)
a1ec4fe7f0 Bug#21039 Transaction cache not flushed after SELECT CREATE
- Add prelocking for stored procedures that uses sp or sf
 - Update test result for sp_error(reported as bug#21294)
 - Make note about new error message from sp-error(bug#17244)
2006-07-26 12:40:26 +02:00
kroki/tomash@moonlight.intranet
89ea3b01b5 BUG#14702: misleading error message when syntax error in
CREATE PROCEDURE

The bug was fixed already.  This changeset adds a test case.
2006-07-24 15:10:50 +04:00
lars@mysql.com
5f37fc4a76 Merge mysql.com:/users/lthalmann/bkroot/mysql-5.1-new-rpl
into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.1-merge
2006-06-16 01:15:19 +02:00
mats@mysql.com
321d9d842f Bug#19066 (DELETE FROM inconsistency for NDB):
Under row-based replication, DELETE FROM will now always be
replicated as individual row deletions, while TRUNCATE TABLE will
always be replicated as a statement.
2006-06-01 11:53:27 +02:00
knielsen@mysql.com
a061c90d8a Merge mysql.com:/usr/local/mysql/tmp_merge
into  mysql.com:/usr/local/mysql/merge-5.1
2006-05-18 11:56:50 +02:00
kroki@mysql.com
0963c705cd Bug#14635: Accept NEW.x as INOUT parameters to stored procedures
from within triggers

Add support for passing NEW.x as INOUT and OUT parameters to stored
procedures.  Passing NEW.x as INOUT parameter requires SELECT and
UPDATE privileges on that column, and passing it as OUT parameter
requires only UPDATE privilege.
2006-05-12 13:55:21 +04:00
konstantin@mysql.com
08eff11273 Merge mysql.com:/opt/local/work/tmp_merge2
into  mysql.com:/opt/local/work/mysql-5.1-merge
2006-03-30 19:12:10 +04:00
pem@mysql.com
e0a2455f19 Merge mysql.com:/extern/mysql/bk/mysql-5.0-runtime
into  mysql.com:/extern/mysql/5.0/bug17015/mysql-5.0-runtime
2006-03-28 15:08:17 +02:00
konstantin@mysql.com
386ec52a6b A fix and test case for Bug#16164 "Easter egg":
SHOW AUTHORS caused 'Packets out of order' in stored functions:
add the corresponding SQLCOM to sp_get_flags_for_command so that
it'd return sp-related flags for it. 
Fix Bug#17403 "Events: packets out of order with show create event"
in the same chaneset.
2006-03-15 20:21:59 +03:00
monty@mysql.com
82b77cdd90 Fixes to embedded server to be able to run tests with it
(Needed for "list of pushes" web page and autopush)
2006-02-24 18:34:15 +02:00
konstantin@mysql.com
a27e32b565 Merge mysql.com:/home/kostja/mysql/mysql-5.0-root
into  mysql.com:/home/kostja/mysql/mysql-5.1-merge
2006-02-22 14:04:24 +03:00
pem@mysql.com
05826af926 Fixed BUG#17015: Routine name truncation not an error
The name length was checked "the old way", not taking charsets into account,
  when creating a stored routine.
  Fixing this enforces the real limit (64 characters) again, and no truncation
  is possible.
2006-02-16 13:40:37 +01:00
ingo@mysql.com
b9bc1e9108 Merge mysql.com:/home/mydev/mysql-5.1
into  mysql.com:/home/mydev/mysql-5.1-wl1563-msg
2006-02-10 20:00:22 +01:00
pem@mysql.com
6f170782b2 Fixed BUG#16896: Stored function: unused AGGREGATE-clause in CREATE FUNCTION
Check if AGGREGATE was given with a stored (non-UDF) function, and return
  error in that case.
  Also made udf_example/udf_test work again, by adding a missing *_init()
  function. (_init() functions required unless --allow_suspicious_udfs is
  given to the server, since March 2005 - it seems udf_example wasn't updated
  at the time.)
2006-02-09 13:00:32 +01:00
konstantin@mysql.com
365404a048 Merge mysql.com:/home/kostja/mysql/tmp_merge
into  mysql.com:/home/kostja/mysql/mysql-5.1-merge
2006-02-08 14:05:19 +03:00
ingo@mysql.com
8906937757 Merge mysql.com:/home/mydev/mysql-5.1
into  mysql.com:/home/mydev/mysql-5.1-wl1563-msg
2006-02-03 17:57:23 +01:00
konstantin@mysql.com
9f0bb47f87 Merge mysql.com:/home/kostja/mysql/tmp_merge
into  mysql.com:/home/kostja/mysql/mysql-5.1-merge
2006-02-02 23:27:06 +03:00
konstantin@mysql.com
065f8066d5 Merge mysql.com:/home/kostja/mysql/mysql-5.0-for_merge
into  mysql.com:/home/kostja/mysql/mysql-5.1-merge
2006-02-02 12:03:35 +03:00
pem@mysql.com
b3ebd755cc Added test case for BUG#15091: Sp Returns Unknown error in order clause....and there is
no order by clause
which was fixed by earlier changesets.
The error message is now the more generic "Unknown table ... in field list".
2006-01-31 17:00:50 +01:00
pem@mysql.com
af11dc3cbe Added test case for BUG#14270: Stored procedures: crash if load index
which was fixed by earlier changesets; LOAD INDEX is not allowed in functions.
  Also testing CACHE INDEX, while OPTIMIZE and CHECK were covered by existing tests already.
2006-01-31 16:27:57 +01:00
ingo@mysql.com
b6e28c99d0 WL#1563 - Modify MySQL to support fast CREATE/DROP INDEX
Change "duplicate key" message to print key name
instead of key number.
2006-01-23 12:17:05 +01:00
pem@mysql.com
3a753667dd Merge mysql.com:/extern/mysql/bk/mysql-5.0
into  mysql.com:/extern/mysql/work/bug15658/mysql-5.0
2006-01-19 11:48:07 +01:00
holyfoot@deer.(none)
c03d025002 Embedded-server related tests fixes 2006-01-19 13:25:12 +04:00
konstantin@mysql.com
8d6c98ed90 Bug#15206: "Misleading message "No data to FETCH":
reword the misleading message.
2006-01-17 21:10:47 +03:00
pem@mysql.com
0cc1acd51c Fixing BUG#15658: Server crashes after creating function as empty string
Empty strings (and names with trailing spaces) should not be allowed.
2006-01-11 15:11:05 +01:00
dlenev@mysql.com
c5c2874152 Fixed sp-error.test result after merging fix for bug #11555 "Stored procedures:
current SP tables locking make impossible view security" with main tree.
2005-12-07 16:55:16 +03:00
dlenev@mysql.com
b5e21b60d9 Merge mysqldev@production.mysql.com:my/mysql-5.0-release
into  mysql.com:/home/dlenev/src/mysql-5.0-bg11555-2
2005-12-07 14:38:20 +03:00
dlenev@mysql.com
40614adf66 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg11555-2
2005-12-07 12:47:25 +03:00
dlenev@mysql.com
06b895c096 Fix for bug #11555 "Stored procedures: current SP tables locking make
impossible view security".

We should not expose names of tables which are explicitly or implicitly (via
routine or trigger) used by view even if we find that they are missing.
So during building of list of prelocked tables for statement we track which
routines (and therefore tables for these routines) are used from views. We
mark elements of LEX::routines set which correspond to routines used in views
by setting Sroutine_hash_entry::belong_to_view member to point to TABLE_LIST
object for topmost view which uses routine. We propagate this mark to all
routines which are used by this routine and which we add to this set. We also
mark tables used by such routine which we add to the list of tables for
prelocking as belonging to this view.
2005-12-07 12:27:17 +03:00
serg@serg.mylan
1aa775aa44 Merge 2005-12-06 18:21:46 +01:00
pem@mysql.com
a0ed1d5aba Merge mysql.com:/usr/local/bk/mysql-5.0
into  mysql.com:/usr/home/pem/bug14233/mysql-5.0
2005-12-06 13:34:18 +01:00
serg@serg.mylan
9c0a8bbd17 this has nothing to do with the bug#13012.
it's about mysql_admin_commands not being reexecution-safe
(and CHECK still isn't)
2005-12-03 15:02:09 +01:00
serg@serg.mylan
b3b72c6329 Bug#13012: REPAIR/BACKUP/RESTORE TABLE cause "packet out of order" in SP.
Mark them properly as result-returning statements
2005-12-02 22:59:45 +01:00
pem@mysql.com
eb5bf2ec33 Fixed BUG#14233: Crash after tampering with the mysql.proc table
Post-review version. Some minor review fixes, but also changed the way
  some errors are handled: Don't return specific parse errors; instead
  always use the more general "table corrupt" error (amended accordingly).
2005-11-25 17:09:26 +01:00
bell@sanja.is.com.ua
db8f03ebe8 Merge sanja.is.com.ua:/home/bell/mysql/bk/work-bug7-5.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-merge-5.0
2005-11-23 01:28:32 +02:00