Commit graph

43756 commits

Author SHA1 Message Date
tsmith@siva.hindu.god
e78b43573c Bug #26598: Create variable to allow turning off of statistic gathering on metadata commands
Add innodb_stats_on_metadata option, which enables gathering
index statistics when processing metadata commands such as
SHOW TABLE STATUS.  Default behavior of the server does not
change (this option is enabled by default).
2007-03-06 10:36:15 -07:00
kaa@polly.local
dc41c428c7 Merge polly.local:/tmp/maint/bug20293/my50-bug20293
into  polly.local:/tmp/maint/bug20293/my51-bug20293
2007-03-06 20:35:25 +03:00
malff/marcsql@weblab.(none)
8643745d3e Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-8407_b
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-8407-merge
2007-03-06 10:33:10 -07:00
kostja@bodhi.local
92b4401690 Merge bodhi.local:/opt/local/work/mysql-5.0-runtime
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2007-03-06 19:24:52 +03:00
kostja@bodhi.local
3d488d496d Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2007-03-06 16:44:14 +03:00
malff/marcsql@weblab.(none)
b216d959bb Bug#8407 (Stored functions/triggers ignore exception handler)
Bug 18914 (Calling certain SPs from triggers fail)
Bug 20713 (Functions will not not continue for SQLSTATE VALUE '42S02')
Bug 21825 (Incorrect message error deleting records in a table with a
  trigger for inserting)
Bug 22580 (DROP TABLE in nested stored procedure causes strange dependency
  error)
Bug 25345 (Cursors from Functions)


This fix resolves a long standing issue originally reported with bug 8407,
which affect the behavior of Stored Procedures, Stored Functions and Trigger
in many different ways, causing symptoms reported by all the bugs listed.
In all cases, the root cause of the problem traces back to 8407 and how the
server locks tables involved with sub statements.

Prior to this fix, the implementation of stored routines would:
- compute the transitive closure of all the tables referenced by a top level
statement
- open and lock all the tables involved
- execute the top level statement
"transitive closure of tables" means collecting:
- all the tables,
- all the stored functions,
- all the views,
- all the table triggers
- all the stored procedures
involved, and recursively inspect these objects definition to find more
references to more objects, until the list of every object referenced does
not grow any more.
This mechanism is known as "pre-locking" tables before execution.
The motivation for locking all the tables (possibly) used at once is to
prevent dead locks.

One problem with this approach is that, if the execution path the code
really takes during runtime does not use a given table, and if the table is
missing, the server would not execute the statement.
This in particular has a major impact on triggers, since a missing table
referenced by an update/delete trigger would prevent an insert trigger to run.

Another problem is that stored routines might define SQL exception handlers
to deal with missing tables, but the server implementation would never give
user code a chance to execute this logic, since the routine is never
executed when a missing table cause the pre-locking code to fail.

With this fix, the internal implementation of the pre-locking code has been
relaxed of some constraints, so that failure to open a table does not
necessarily prevent execution of a stored routine.

In particular, the pre-locking mechanism is now behaving as follows:

1) the first step, to compute the transitive closure of all the tables
possibly referenced by a statement, is unchanged.

2) the next step, which is to open all the tables involved, only attempts
to open the tables added by the pre-locking code, but silently fails without
reporting any error or invoking any exception handler is the table is not
present. This is achieved by trapping internal errors with
Prelock_error_handler

3) the locking step only locks tables that were successfully opened.

4) when executing sub statements, the list of tables used by each statements
is evaluated as before. The tables needed by the sub statement are expected
to be already opened and locked. Statement referencing tables that were not
opened in step 2) will fail to find the table in the open list, and only at
this point will execution of the user code fail.

5) when a runtime exception is raised at 4), the instruction continuation
destination (the next instruction to execute in case of SQL continue
handlers) is evaluated.
This is achieved with sp_instr::exec_open_and_lock_tables()

6) if a user exception handler is present in the stored routine, that
handler is invoked as usual, so that ER_NO_SUCH_TABLE exceptions can be
trapped by stored routines. If no handler exists, then the runtime execution
will fail as expected.

With all these changes, a side effect is that view security is impacted, in
two different ways.

First, a view defined as "select stored_function()", where the stored
function references a table that may not exist, is considered valid.
The rationale is that, because the stored function might trap exceptions
during execution and still return a valid result, there is no way to decide
when the view is created if a missing table really cause the view to be invalid.

Secondly, testing for existence of tables is now done later during
execution. View security, which consist of trapping errors and return a
generic ER_VIEW_INVALID (to prevent disclosing information) was only
implemented at very specific phases covering *opening* tables, but not
covering the runtime execution. Because of this existing limitation,
errors that were previously trapped and converted into ER_VIEW_INVALID are
not trapped, causing table names to be reported to the user.
This change is exposing an existing problem, which is independent and will
be resolved separately.
2007-03-05 19:42:07 -07:00
kostja@bodhi.local
f49f21dc09 Merge bodhi.local:/opt/local/work/mysql-4.1-runtime
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2007-03-06 00:51:36 +03:00
ramil/ram@ramil.myoffice.izhnet.ru
361a15000a Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  mysql.com:/home/ram/work/b26038/b26038.5.1
2007-03-05 18:22:36 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
fe801fcf5d Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/home/ram/work/b26038/b26038.5.0
2007-03-05 18:22:35 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
213957d06f Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1-maint
into  mysql.com:/home/ram/work/b26038/b26038.4.1
2007-03-05 18:21:52 +04:00
tnurnberg@mysql.com/sin.mysql.com
c53433f307 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/home/tnurnberg/21103/50-21103
2007-03-05 14:18:27 +01:00
ramil/ram@ramil.myoffice.izhnet.ru
ca66f604f4 Merge mysql.com:/home/ram/work/b26038/b26038.5.0
into  mysql.com:/home/ram/work/b26038/b26038.5.1
2007-03-05 17:12:37 +04:00
tnurnberg@sin.mysql.com
57e300af82 Merge mysql.com:/home/tnurnberg/21103/50-21103
into  mysql.com:/home/tnurnberg/21103/51-21103
2007-03-05 14:04:23 +01:00
tnurnberg@mysql.com/sin.mysql.com
b5aeef5dea Bug#21103: DATE column not compared as DATE
When comparing a DATE field with a DATETIME constant, we now compare
as DATETIMEs, not as DATEs.  Fix BDB queries to still work.
2007-03-05 14:02:29 +01:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
3a5b7e63e2 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1-maint
into  mysql.com:/home/ram/work/b23616/b23616.4.1
2007-03-05 12:07:59 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
9900d2f213 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/home/ram/work/b23616/b23616.5.0
2007-03-05 12:04:37 +04:00
ramil/ram@ramil.myoffice.izhnet.ru
b69493027e Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  mysql.com:/home/ram/work/b23616/b23616.5.1
2007-03-05 11:57:51 +04:00
tnurnberg@mysql.com/sin.intern.azundris.com
7217d20725 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/home/tnurnberg/21103/50-21103
2007-03-03 01:00:30 +01:00
tnurnberg@sin.intern.azundris.com
edf3519b23 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  mysql.com:/home/tnurnberg/21103/51-21103
2007-03-03 00:56:21 +01:00
kent@kent-amd64.(none)
73b1745ede Merge mysql.com:/home/kent/bk/tmp/mysql-5.0-build
into  mysql.com:/home/kent/bk/tmp/mysql-5.1-build
2007-03-02 20:01:02 +01:00
kent@mysql.com/kent-amd64.(none)
4889fdfafd Merge mysql.com:/home/kent/bk/tmp/mysql-4.1-build
into  mysql.com:/home/kent/bk/tmp/mysql-5.0-build
2007-03-02 19:59:36 +01:00
kent@mysql.com/kent-amd64.(none)
47c692ec02 Merge mysql.com:/home/kent/bk/tmp/mysql-4.0
into  mysql.com:/home/kent/bk/tmp/mysql-4.1-build
2007-03-02 19:22:53 +01:00
kent@mysql.com/kent-amd64.(none)
b30a4df3f5 Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-4.0
into  mysql.com:/home/kent/bk/tmp/mysql-4.0
2007-03-02 19:21:11 +01:00
joerg@trift2.
7d0ec0bee3 Merge jbruehe@bk-internal.mysql.com:/home/bk/mysql-5.0-build
into  trift2.:/MySQL/M50/push-5.0
2007-03-02 19:09:14 +01:00
joerg@trift2.
6ac5fa4c18 Merge jbruehe@bk-internal.mysql.com:/home/bk/mysql-5.1-build
into  trift2.:/MySQL/M51/push-5.1
2007-03-02 19:04:15 +01:00
joerg@trift2.
a91f84eb09 Merge trift2.:/MySQL/M50/manpages-5.0
into  trift2.:/MySQL/M51/manpages-5.1
2007-03-02 17:15:13 +01:00
joerg@trift2.
9cdd21515b Merge trift2.:/MySQL/M41/manpages-4.1
into  trift2.:/MySQL/M50/manpages-5.0
2007-03-02 17:01:24 +01:00
joerg@trift2.
57bc6066e3 Merge trift2.:/MySQL/M40/manpages-4.0
into  trift2.:/MySQL/M41/manpages-4.1
2007-03-02 16:34:29 +01:00
joerg@trift2.
6158657090 More man pages for the RPMs. 2007-03-02 16:32:27 +01:00
joerg@trift2.
c1c22df202 Another man page in the RPMs. 2007-03-02 16:30:22 +01:00
tnurnberg@sin.intern.azundris.com
36a5e0b3df Merge mysql.com:/home/tnurnberg/21103/50-21103
into  mysql.com:/home/tnurnberg/21103/51-21103
2007-03-02 15:25:06 +01:00
tnurnberg@mysql.com/sin.intern.azundris.com
f37267bb3c Bug #21103: DATE column not compared as DATE
If we compare two items A and B, with B being (a constant) of a
larger type, then A gets promoted to B's type for comparison if
it's a constant, function, or CAST() column, but B gets demoted
to A's type if A is a (not explicitly CAST()) column. This is
counter-intuitive and not mandated by the standard.
 
Disabling optimisation where it would be lossy so field value
will properly get promoted and compared as binary string (rather
than as integers).
2007-03-02 15:23:13 +01:00
joerg@trift2.
40124c59fa Merge trift2.:/MySQL/M50/manpages-5.0
into  trift2.:/MySQL/M51/manpages-5.1
2007-03-02 14:23:12 +01:00
joerg@trift2.
942822321c Merge trift2.:/MySQL/M41/manpages-4.1
into  trift2.:/MySQL/M50/manpages-5.0
2007-03-02 14:20:43 +01:00
joerg@trift2.
783e907f59 Merge trift2.:/MySQL/M40/manpages-4.0
into  trift2.:/MySQL/M41/manpages-4.1
2007-03-02 14:17:04 +01:00
joerg@trift2.
ce9452152e Add man pages for NDB to the RPMs. 2007-03-02 14:13:13 +01:00
joerg@trift2.
dfce4c8ffd Add the man pages for NDB to the RPMs. 2007-03-02 14:08:32 +01:00
joerg@trift2.
3e2e58d60e Add the man pages for NDB to the RPMs. 2007-03-02 14:05:43 +01:00
joerg@trift2.
1775f82d58 Add missing man pages to the RPMs. 2007-03-02 14:03:28 +01:00
kostja@bodhi.local
3f8c35d94b Freeze the number of conflicts. We should not introduce any more
conflicts without proper analysis and documentation of the nature of
the conflict.
2007-03-02 15:05:16 +03:00
kostja@bodhi.local
89bd002cc8 Rename a macro to better reflect the action taken. 2007-03-02 14:29:51 +03:00
ramil/ram@ramil.myoffice.izhnet.ru
363b0b6ff1 Merge mysql.com:/home/ram/work/b23616/b23616.5.0
into  mysql.com:/home/ram/work/b23616/b23616.5.1
2007-03-02 15:13:28 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
f165316cfc after merge fix (bug #26038)
Item_func_geometry_from_text::val_str() should set null_value
in case of wrong data.
2007-03-02 15:09:44 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
4a5dd6956d Merge mysql.com:/home/ram/work/b23616/b23616.4.1
into  mysql.com:/home/ram/work/b23616/b23616.5.0
2007-03-02 15:09:20 +04:00
rafal@quant.(none)
d445d5e4cc Removing global events_till_disconnect variable as it is replaced by a member of
master info structure.
2007-03-02 10:35:04 +01:00
Kristofer.Pettersson@naruto.
cba58e5910 Merge BUG: Windows target won't compile.
- winsock2.h must be included before windows.h
2007-03-02 09:04:23 +01:00
malff/marcsql@weblab.(none)
2b1a04e7b9 Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-26093
2007-03-01 20:08:58 -07:00
malff/marcsql@weblab.(none)
6cf49ef065 Manual merge 2007-03-01 20:04:49 -07:00
malff/marcsql@weblab.(none)
348cf79bf7 Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-26093
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-26093-merge
2007-03-01 19:22:43 -07:00
malff/marcsql@weblab.(none)
ad45f0168d Bug#26093 (SELECT BENCHMARK() for SELECT statements does not produce valid
results)

Before this fix, the function BENCHMARK() would fail to evaluate expressions
like "(select avg(a) from t1)" in debug builds (with an assert),
or would report a time of zero in non debug builds.

The root cause is that evaluation of DECIMAL_RESULT expressions was not
supported in Item_func_benchmark::val_int().

This has been fixed by this change.
2007-03-01 19:20:47 -07:00