mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts: Text conflict in client/mysqlbinlog.cc Text conflict in mysql-test/r/explain.result Text conflict in mysql-test/r/subselect.result Text conflict in mysql-test/r/subselect3.result Text conflict in mysql-test/r/type_datetime.result Text conflict in sql/share/Makefile.am
This commit is contained in:
commit
dbbdc4b196
50 changed files with 1221 additions and 420 deletions
523
COPYING
523
COPYING
|
@ -1,352 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Preamble
|
||||
|
||||
Preamble
|
||||
========
|
||||
|
||||
The licenses for most software are designed to take away your freedom
|
||||
to share and change it. By contrast, the GNU General Public License is
|
||||
intended to guarantee your freedom to share and change free
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price.
|
||||
Our General Public Licenses are designed to make sure that you have
|
||||
the freedom to distribute copies of free software (and charge for this
|
||||
service if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs; and that you know you can do these things.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone
|
||||
to deny you these rights or to ask you to surrender the rights. These
|
||||
restrictions translate to certain responsibilities for you if you
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that you
|
||||
have. You must make sure that they, too, receive or can get the source
|
||||
code. And you must show them these terms so they know their rights.
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents.
|
||||
We wish to avoid the danger that redistributors of a free program will
|
||||
individually obtain patent licenses, in effect making the program
|
||||
proprietary. To prevent this, we have made it clear that any patent
|
||||
must be licensed for everyone's free use or not licensed at all.
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
0. This License applies to any program or other work which contains a
|
||||
notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program",
|
||||
below, refers to any such program or work, and a "work based on
|
||||
the Program" means either the Program or any derivative work under
|
||||
copyright law: that is to say, a work containing the Program or a
|
||||
portion of it, either verbatim or with modifications and/or
|
||||
translated into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".) Each
|
||||
licensee is addressed as "you".
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
Activities other than copying, distribution and modification are
|
||||
not covered by this License; they are outside its scope. The act
|
||||
of running the Program is not restricted, and the output from the
|
||||
Program is covered only if its contents constitute a work based on
|
||||
the Program (independent of having been made by running the
|
||||
Program). Whether that is true depends on what the Program does.
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any
|
||||
warranty; and give any other recipients of the Program a copy of
|
||||
this License along with the Program.
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange
|
||||
for a fee.
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a. You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b. You must cause any work that you distribute or publish, that
|
||||
in whole or in part contains or is derived from the Program
|
||||
or any part thereof, to be licensed as a whole at no charge
|
||||
to all third parties under the terms of this License.
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c. If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display
|
||||
an announcement including an appropriate copyright notice and
|
||||
a notice that there is no warranty (or else, saying that you
|
||||
provide a warranty) and that users may redistribute the
|
||||
program under these conditions, and telling the user how to
|
||||
view a copy of this License. (Exception: if the Program
|
||||
itself is interactive but does not normally print such an
|
||||
announcement, your work based on the Program is not required
|
||||
to print an announcement.)
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the
|
||||
Program, and can be reasonably considered independent and separate
|
||||
works in themselves, then this License, and its terms, do not
|
||||
apply to those sections when you distribute them as separate
|
||||
works. But when you distribute the same sections as part of a
|
||||
whole which is a work based on the Program, the distribution of
|
||||
the whole must be on the terms of this License, whose permissions
|
||||
for other licensees extend to the entire whole, and thus to each
|
||||
and every part regardless of who wrote it.
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or
|
||||
contest your rights to work written entirely by you; rather, the
|
||||
intent is to exercise the right to control the distribution of
|
||||
derivative or collective works based on the Program.
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the
|
||||
Program with the Program (or with a work based on the Program) on
|
||||
a volume of a storage or distribution medium does not bring the
|
||||
other work under the scope of this License.
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms
|
||||
of Sections 1 and 2 above provided that you also do one of the
|
||||
following:
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a. Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for
|
||||
software interchange; or,
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b. Accompany it with a written offer, valid for at least three
|
||||
years, to give any third-party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange; or,
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c. Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with
|
||||
such an offer, in accord with Subsection b above.)
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete
|
||||
source code means all the source code for all modules it contains,
|
||||
plus any associated interface definition files, plus the scripts
|
||||
used to control compilation and installation of the executable.
|
||||
However, as a special exception, the source code distributed need
|
||||
not include anything that is normally distributed (in either
|
||||
source or binary form) with the major components (compiler,
|
||||
kernel, and so on) of the operating system on which the executable
|
||||
runs, unless that component itself accompanies the executable.
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this
|
||||
License. However, parties who have received copies, or rights,
|
||||
from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify
|
||||
or distribute the Program or its derivative works. These actions
|
||||
are prohibited by law if you do not accept this License.
|
||||
Therefore, by modifying or distributing the Program (or any work
|
||||
based on the Program), you indicate your acceptance of this
|
||||
License to do so, and all its terms and conditions for copying,
|
||||
distributing or modifying the Program or works based on it.
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program
|
||||
subject to these terms and conditions. You may not impose any
|
||||
further restrictions on the recipients' exercise of the rights
|
||||
granted herein. You are not responsible for enforcing compliance
|
||||
by third parties to this License.
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent
|
||||
issues), conditions are imposed on you (whether by court order,
|
||||
agreement or otherwise) that contradict the conditions of this
|
||||
License, they do not excuse you from the conditions of this
|
||||
License. If you cannot distribute so as to satisfy simultaneously
|
||||
your obligations under this License and any other pertinent
|
||||
obligations, then as a consequence you may not distribute the
|
||||
Program at all. For example, if a patent license would not permit
|
||||
royalty-free redistribution of the Program by all those who
|
||||
receive copies directly or indirectly through you, then the only
|
||||
way you could satisfy both it and this License would be to refrain
|
||||
entirely from distribution of the Program.
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable
|
||||
under any particular circumstance, the balance of the section is
|
||||
intended to apply and the section as a whole is intended to apply
|
||||
in other circumstances.
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of
|
||||
any such claims; this section has the sole purpose of protecting
|
||||
the integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is
|
||||
willing to distribute software through any other system and a
|
||||
licensee cannot impose that choice.
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed
|
||||
to be a consequence of the rest of this License.
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces,
|
||||
the original copyright holder who places the Program under this
|
||||
License may add an explicit geographical distribution limitation
|
||||
excluding those countries, so that distribution is permitted only
|
||||
in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of
|
||||
this License.
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new
|
||||
versions of the General Public License from time to time. Such
|
||||
new versions will be similar in spirit to the present version, but
|
||||
may differ in detail to address new problems or concerns.
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies a version number of this License which applies
|
||||
to it and "any later version", you have the option of following
|
||||
the terms and conditions either of that version or of any later
|
||||
version published by the Free Software Foundation. If the Program
|
||||
does not specify a version number of this License, you may choose
|
||||
any version ever published by the Free Software Foundation.
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the
|
||||
author to ask for permission. For software which is copyrighted
|
||||
by the Free Software Foundation, write to the Free Software
|
||||
Foundation; we sometimes make exceptions for this. Our decision
|
||||
will be guided by the two goals of preserving the free status of
|
||||
all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
|
||||
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
|
||||
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
|
||||
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
|
||||
QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
|
||||
SERVICING, REPAIR OR CORRECTION.
|
||||
NO WARRANTY
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
|
||||
MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
|
||||
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
|
||||
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
|
||||
INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
|
||||
OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
|
||||
OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
How to Apply These Terms to Your New Programs
|
||||
=============================================
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these
|
||||
terms.
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to
|
||||
attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
|
||||
Copyright (C) YYYY NAME OF AUTHOR
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the
|
||||
appropriate parts of the General Public License. Of course, the
|
||||
commands you use may be called something other than `show w' and `show
|
||||
c'; they could even be mouse-clicks or menu items--whatever suits your
|
||||
program.
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
SIGNATURE OF TY COON, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library,
|
||||
you may consider it more useful to permit linking proprietary
|
||||
applications with the library. If this is what you want to do, use the
|
||||
GNU Library General Public License instead of this License.
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2008 MySQL AB
|
||||
/* Copyright 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -13,6 +13,11 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define COPYRIGHT_NOTICE "\
|
||||
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.\n\
|
||||
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
|
||||
and you are welcome to modify and redistribute it under the GPL v2 license\n"
|
||||
|
||||
/* mysql command tool
|
||||
* Commands compatible with mSQL by David J. Hughes
|
||||
*
|
||||
|
@ -1167,6 +1172,8 @@ int main(int argc,char *argv[])
|
|||
mysql_thread_id(&mysql), server_version_string(&mysql));
|
||||
put_info((char*) glob_buffer.ptr(),INFO_INFO);
|
||||
|
||||
put_info(COPYRIGHT_NOTICE, INFO_INFO);
|
||||
|
||||
#ifdef HAVE_READLINE
|
||||
initialize_readline((char*) my_progname);
|
||||
if (!status.batch && !quick && !opt_html && !opt_xml)
|
||||
|
@ -1209,13 +1216,11 @@ int main(int argc,char *argv[])
|
|||
sprintf(histfile_tmp, "%s.TMP", histfile);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
sprintf(buff, "%s",
|
||||
#ifndef NOT_YET
|
||||
"Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n");
|
||||
#else
|
||||
"Type 'help [[%]function name[%]]' to get help on usage of function.\n");
|
||||
#endif
|
||||
put_info(buff,INFO_INFO);
|
||||
status.exit_status= read_and_execute(!status.batch);
|
||||
if (opt_outfile)
|
||||
|
@ -1573,10 +1578,7 @@ static void usage(int version)
|
|||
|
||||
if (version)
|
||||
return;
|
||||
printf("\
|
||||
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n\
|
||||
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
|
||||
and you are welcome to modify and redistribute it under the GPL license\n");
|
||||
printf("%s", COPYRIGHT_NOTICE);
|
||||
printf("Usage: %s [OPTIONS] [database]\n", my_progname);
|
||||
my_print_help(my_long_options);
|
||||
print_defaults("my", load_default_groups);
|
||||
|
|
|
@ -45,7 +45,7 @@ static DYNAMIC_STRING conn_args;
|
|||
static char *opt_password= 0;
|
||||
static my_bool tty_password= 0;
|
||||
|
||||
static char opt_tmpdir[FN_REFLEN];
|
||||
static char opt_tmpdir[FN_REFLEN] = "";
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
static char *default_dbug_option= (char*) "d:t:O,/tmp/mysql_upgrade.trace";
|
||||
|
@ -464,7 +464,8 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
|
|||
|
||||
DBUG_ENTER("run_query");
|
||||
DBUG_PRINT("enter", ("query: %s", query));
|
||||
if ((fd= create_temp_file(query_file_path, opt_tmpdir,
|
||||
if ((fd= create_temp_file(query_file_path,
|
||||
opt_tmpdir[0] ? opt_tmpdir : NULL,
|
||||
"sql", O_CREAT | O_SHARE | O_RDWR,
|
||||
MYF(MY_WME))) < 0)
|
||||
die("Failed to create temporary file for defaults");
|
||||
|
|
|
@ -832,7 +832,11 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
|||
print_event_info->common_header_len=
|
||||
glob_description_event->common_header_len;
|
||||
ev->print(result_file, print_event_info);
|
||||
ev->temp_buf= 0; // as the event ref is zeroed
|
||||
if (!remote_opt)
|
||||
ev->free_temp_buf(); // free memory allocated in dump_local_log_entries
|
||||
else
|
||||
// disassociate but not free dump_remote_log_entries time memory
|
||||
ev->temp_buf= 0;
|
||||
/*
|
||||
We don't want this event to be deleted now, so let's hide it (I
|
||||
(Guilhem) should later see if this triggers a non-serious Valgrind
|
||||
|
@ -2018,7 +2022,8 @@ int main(int argc, char** argv)
|
|||
|
||||
my_init_time(); // for time functions
|
||||
|
||||
load_defaults("my", load_default_groups, &argc, &argv);
|
||||
if (load_defaults("my", load_default_groups, &argc, &argv))
|
||||
exit(1);
|
||||
defaults_argv= argv;
|
||||
parse_args(&argc, (char***)&argv);
|
||||
|
||||
|
|
|
@ -1245,7 +1245,7 @@ void die(const char *fmt, ...)
|
|||
Help debugging by displaying any warnings that might have
|
||||
been produced prior to the error
|
||||
*/
|
||||
if (cur_con)
|
||||
if (cur_con && !cur_con->pending)
|
||||
show_warnings_before_error(&cur_con->mysql);
|
||||
|
||||
cleanup_and_exit(1);
|
||||
|
|
|
@ -130,12 +130,12 @@ uninstall-local:
|
|||
# mtr - a shortcut for executing mysql-test-run.pl
|
||||
mtr:
|
||||
$(RM) -f mtr
|
||||
$(LN_S) $(srcdir)/mysql-test-run.pl mtr
|
||||
$(LN_S) mysql-test-run.pl mtr
|
||||
|
||||
# mysql-test-run - a shortcut for executing mysql-test-run.pl
|
||||
mysql-test-run:
|
||||
$(RM) -f mysql-test-run
|
||||
$(LN_S) $(srcdir)/mysql-test-run.pl mysql-test-run
|
||||
$(LN_S) mysql-test-run.pl mysql-test-run
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
|
25
mysql-test/include/view_alias.inc
Normal file
25
mysql-test/include/view_alias.inc
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Routine to be called by t/view.inc
|
||||
#
|
||||
# The variable $after_select must be set before calling this routine.
|
||||
|
||||
eval CREATE VIEW v1 AS SELECT $after_select;
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
#
|
||||
# Extract the VIEW's SELECT from INFORMATION_SCHEMA.VIEWS
|
||||
let $query1 = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
|
||||
#
|
||||
# Extract the VIEW's SELECT from SHOW CREATE VIEW
|
||||
# SHOW CREATE VIEW v1
|
||||
# View Create View character_set_client collation_connection
|
||||
# v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select '<--- .....
|
||||
let $value= query_get_value(SHOW CREATE VIEW v1, Create View, 1);
|
||||
let $query2 = `SELECT SUBSTR("$value",INSTR("$value",' as select ') + CHAR_LENGTH(' as '))`;
|
||||
DROP VIEW v1;
|
||||
|
||||
# Recreate the view based on SELECT from INFORMATION_SCHEMA.VIEWS
|
||||
eval CREATE VIEW v1 AS $query1;
|
||||
DROP VIEW v1;
|
||||
# Recreate the view based on SHOW CREATE VIEW
|
||||
eval CREATE VIEW v1 AS $query2;
|
||||
DROP VIEW v1;
|
||||
|
|
@ -88,7 +88,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a TIMESTAMP);
|
||||
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
|
||||
|
|
|
@ -224,7 +224,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select 1 AS `1` from `test`.`t2` where (`test`.`t2`.`d` = NULL)) AS `(SELECT 1 FROM t2 WHERE d = c)` from dual
|
||||
Note 1003 select (select 1 from `test`.`t2` where (`test`.`t2`.`d` = NULL)) AS `(SELECT 1 FROM t2 WHERE d = c)` from dual
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#30302: Tables that were optimized away are printed in the
|
||||
|
|
|
@ -1526,4 +1526,19 @@ SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1
|
|||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #51357: crash when using handler commands on spatial indexes
|
||||
#
|
||||
CREATE TABLE t1(a GEOMETRY NOT NULL,SPATIAL INDEX a(a));
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ a FIRST;
|
||||
a
|
||||
HANDLER t1 READ a NEXT;
|
||||
a
|
||||
HANDLER t1 READ a PREV;
|
||||
a
|
||||
HANDLER t1 READ a LAST;
|
||||
a
|
||||
HANDLER t1 CLOSE;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
|
|
|
@ -1742,7 +1742,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select `test`.`t1`.`a` AS `a`) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by ((select `test`.`t1`.`a` AS `a`) + 0)
|
||||
Note 1003 select (select `test`.`t1`.`a`) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by ((select `test`.`t1`.`a`) + 0)
|
||||
EXPLAIN EXTENDED
|
||||
SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY -aa;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
|
@ -1750,7 +1750,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select `test`.`t1`.`a` AS `a`) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by -((select `test`.`t1`.`a` AS `a`))
|
||||
Note 1003 select (select `test`.`t1`.`a`) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by -((select `test`.`t1`.`a`))
|
||||
# should return only one record
|
||||
SELECT (SELECT tt.a FROM t1 tt LIMIT 1) aa, COUNT(DISTINCT b) FROM t1
|
||||
GROUP BY aa;
|
||||
|
|
|
@ -2219,6 +2219,73 @@ Trigger sql_mode SQL Original Statement character_set_client collation_connectio
|
|||
tr1 CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo() latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1, t2, t3;
|
||||
#
|
||||
# BUG#48265 - MRG_MYISAM problem (works in 5.0.85, does't work in 5.1.40)
|
||||
#
|
||||
CREATE DATABASE `test/1`;
|
||||
CREATE TABLE `test/1`.`t/1`(a INT);
|
||||
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test/1`.`t/1`)
|
||||
DROP TABLE m1;
|
||||
CREATE TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM `test/1`.m1;
|
||||
a
|
||||
SHOW CREATE TABLE `test/1`.m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t/1`)
|
||||
DROP TABLE `test/1`.m1;
|
||||
DROP TABLE `test/1`.`t/1`;
|
||||
CREATE TEMPORARY TABLE `test/1`.`t/1`(a INT);
|
||||
CREATE TEMPORARY TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TEMPORARY TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test/1`.`t/1`)
|
||||
DROP TABLE m1;
|
||||
CREATE TEMPORARY TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM `test/1`.m1;
|
||||
a
|
||||
SHOW CREATE TABLE `test/1`.m1;
|
||||
Table Create Table
|
||||
m1 CREATE TEMPORARY TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t/1`)
|
||||
DROP TABLE `test/1`.m1;
|
||||
DROP TABLE `test/1`.`t/1`;
|
||||
DROP DATABASE `test/1`;
|
||||
CREATE TABLE `t@1`(a INT);
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t@1`)
|
||||
DROP TABLE `t@1`;
|
||||
CREATE DATABASE `test@1`;
|
||||
CREATE TABLE `test@1`.`t@1`(a INT);
|
||||
FLUSH TABLE m1;
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test@1`.`t@1`)
|
||||
DROP TABLE m1;
|
||||
DROP TABLE `test@1`.`t@1`;
|
||||
DROP DATABASE `test@1`;
|
||||
End of 5.1 tests
|
||||
#
|
||||
# An additional test case for Bug#27430 Crash in subquery code
|
||||
|
|
|
@ -2356,4 +2356,37 @@ CHECKSUM TABLE t3 EXTENDED;
|
|||
Table Checksum
|
||||
test.t3 3775188275
|
||||
DROP TABLE t1, t2, t3;
|
||||
#
|
||||
# BUG#51307 - widespread corruption with partitions and insert...select
|
||||
#
|
||||
CREATE TABLE t1(a CHAR(255), KEY(a));
|
||||
SELECT * FROM t1, t1 AS a1;
|
||||
a a
|
||||
SET myisam_sort_buffer_size=4;
|
||||
INSERT INTO t1 VALUES
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0');
|
||||
Warnings:
|
||||
Error 1034 myisam_sort_buffer_size is too small
|
||||
Error 1034 Number of rows changed from 0 to 157
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
INSERT INTO t1 VALUES('1');
|
||||
SELECT * FROM t1, t1 AS a1 WHERE t1.a=1 AND a1.a=1;
|
||||
a a
|
||||
1 1
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -1786,7 +1786,7 @@ prepare stmt from "create view v1 (c,d,e,f) as select a,b,a in (select a+2 from
|
|||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) AS `a+2` from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` AS `a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c d e f
|
||||
drop view v1;
|
||||
|
@ -1794,7 +1794,7 @@ execute stmt;
|
|||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) AS `a+2` from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` AS `a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c d e f
|
||||
drop view v1;
|
||||
|
|
|
@ -32,7 +32,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1249 Select 2 was reduced during optimization
|
||||
Note 1003 select (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
Note 1003 select (select 0 union select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
|
||||
ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
|
||||
|
@ -50,7 +50,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
Warnings:
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select 1 AS `1` from dual having ((select '1' AS `a`) = 1)
|
||||
Note 1003 select 1 AS `1` from dual having ((select '1') = 1)
|
||||
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
1
|
||||
1
|
||||
|
@ -187,7 +187,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` AS `a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) AS `max(t2.a)*4` from `test`.`t2`)) order by `a`)
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)) order by `a`)
|
||||
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
|
||||
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
|
||||
3 1
|
||||
|
@ -203,7 +203,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select (select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from dual
|
||||
Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from dual
|
||||
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
|
||||
a
|
||||
2
|
||||
|
@ -224,7 +224,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) AS `min(t3.a)` from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
select * from t3 where exists (select * from t2 where t2.b=t3.a);
|
||||
a
|
||||
7
|
||||
|
@ -314,7 +314,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
|||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select (select '2' AS `a` from dual where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` AS `a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
Note 1003 select (select '2' from dual where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
|
||||
|
@ -332,7 +332,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 AS `Not_used` from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
|
||||
ERROR 23000: Column 'a' in field list is ambiguous
|
||||
drop table t1,t2,t3;
|
||||
|
@ -367,7 +367,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 37 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' AS `email` from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
|
@ -399,7 +399,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||
date
|
||||
2002-08-03
|
||||
|
@ -743,7 +743,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `1` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 AS `3` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
|
||||
id
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
|
||||
|
@ -906,7 +906,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (a float);
|
||||
select 10.5 IN (SELECT * from t1 LIMIT 1);
|
||||
|
@ -1018,19 +1018,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select rand() AS `RAND()` from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select encrypt('test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select benchmark(1,1) AS `BENCHMARK(1,1)` from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`mot` varchar(30) character set latin1 NOT NULL default '',
|
||||
|
@ -1125,7 +1125,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() AS `rand()` from `test`.`t1` limit 1) AS `(select rand() from t1 limit 1)` from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
|
@ -1179,7 +1179,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
0 IN (SELECT 1 FROM t1 a)
|
||||
|
@ -1189,7 +1189,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL default '0',
|
||||
|
@ -1234,7 +1234,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) AS `MAX(salary)` from `test`.`t1`))
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
ID int(10) unsigned NOT NULL auto_increment,
|
||||
|
@ -1317,7 +1317,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 100.00
|
||||
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int, b int, index a (a,b));
|
||||
create table t2 (a int, index a (a));
|
||||
|
@ -1356,7 +1356,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 100.00 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
insert into t1 values (3,31);
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
a
|
||||
|
@ -1515,7 +1515,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select NULL AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where a >= some (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where a >= some (select b from t2 group by 1);
|
||||
|
@ -1523,7 +1523,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select NULL AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where NULL >= any (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2);
|
||||
|
@ -1566,7 +1566,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) AS `max(b)` from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
drop table t2, t3;
|
||||
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
|
||||
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
|
||||
|
@ -1743,7 +1743,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` AS `id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
|
||||
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
|
||||
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
|
||||
|
@ -2279,7 +2279,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 AS `Not_used` from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (t1_a int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
@ -2820,19 +2820,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = 'N') and (<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) and (<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`))))
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = 'N') and (<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) and (<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`))))
|
||||
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a char(5), b char(5));
|
||||
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
|
||||
|
@ -4275,7 +4275,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select 2 AS `2` from `test`.`t1` where exists(select 1 AS `1` from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))
|
||||
Note 1003 select 2 AS `2` from `test`.`t1` where exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))
|
||||
EXPLAIN EXTENDED
|
||||
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
|
||||
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
|
||||
|
@ -4353,13 +4353,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 AS `1` from `test`.`t1` group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1))))
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1))))
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45061: Incorrectly market field caused wrong result.
|
||||
|
|
|
@ -30,7 +30,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2`
|
||||
explain extended
|
||||
select a, oref from t2
|
||||
where a in (select max(ie) from t1 where oref=t2.oref group by grp);
|
||||
|
@ -39,7 +39,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))
|
||||
select a, oref, a in (
|
||||
select max(ie) from t1 where oref=t2.oref group by grp union
|
||||
select max(ie) from t1 where oref=t2.oref group by grp
|
||||
|
@ -68,7 +68,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
|
||||
Note 1003 select <in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int, oref int, key(a));
|
||||
insert into t1 values
|
||||
|
@ -157,7 +157,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) having trigcond(<is_not_null_test>(`test`.`t1`.`a`)))) AS `Z` from `test`.`t3`
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) having trigcond(<is_not_null_test>(`test`.`t1`.`a`)))) AS `Z` from `test`.`t3`
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int NOT NULL, b int NOT NULL, key(a));
|
||||
insert into t1 values
|
||||
|
@ -185,7 +185,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`))))) AS `Z` from `test`.`t3`
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`))))) AS `Z` from `test`.`t3`
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (oref int, grp int);
|
||||
insert into t1 (oref, grp) values
|
||||
|
@ -209,7 +209,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 't2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0))))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0))))))) AS `Z` from `test`.`t2`
|
||||
drop table t1, t2;
|
||||
create table t1 (a int, b int, primary key (a));
|
||||
insert into t1 values (1,1), (3,1),(100,1);
|
||||
|
@ -258,7 +258,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`)))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`)))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`))))) AS `Z` from `test`.`t2`
|
||||
select a,b, oref,
|
||||
(a,b) in (select a,b from t1,t4 where c=t2.oref) Z
|
||||
from t2;
|
||||
|
@ -703,7 +703,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` where ((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)) having <is_not_null_test>(`test`.`t1`.`a`))))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t1` where ((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)) having <is_not_null_test>(`test`.`t1`.`a`))))))
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
|
||||
a
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4));
|
||||
|
@ -864,7 +864,7 @@ Level Code Message
|
|||
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
|
||||
Error 1054 Unknown column 'c' in 'field list'
|
||||
Note 1003 select `c` AS `c` from (select (select count(`test`.`t1`.`a`) AS `COUNT(a)` from dual group by `c`) AS `(SELECT COUNT(a) FROM
|
||||
Note 1003 select `c` AS `c` from (select (select count(`test`.`t1`.`a`) from dual group by `c`) AS `(SELECT COUNT(a) FROM
|
||||
(SELECT COUNT(b) FROM t1) AS x GROUP BY c
|
||||
)` from `test`.`t1` group by `test`.`t1`.`b`) `y`
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -2087,6 +2087,30 @@ ERROR 42S02: Table 'test.a_nonextisting_table' doesn't exist
|
|||
SELECT * FROM t2;
|
||||
a b
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#51650 crash with user variables and triggers
|
||||
#
|
||||
DROP TRIGGER IF EXISTS trg1;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE TABLE t1 (b VARCHAR(50) NOT NULL);
|
||||
CREATE TABLE t2 (a VARCHAR(10) NOT NULL DEFAULT '');
|
||||
CREATE TRIGGER trg1 AFTER INSERT ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
SELECT 1 FROM t1 c WHERE
|
||||
(@bug51650 IS NULL OR @bug51650 != c.b) AND c.b = NEW.a LIMIT 1 INTO @foo;
|
||||
END//
|
||||
SET @bug51650 = 1;
|
||||
INSERT IGNORE INTO t2 VALUES();
|
||||
Warnings:
|
||||
Warning 1329 No data - zero rows fetched, selected, or processed
|
||||
INSERT IGNORE INTO t1 SET b = '777';
|
||||
INSERT IGNORE INTO t2 SET a = '111';
|
||||
Warnings:
|
||||
Warning 1329 No data - zero rows fetched, selected, or processed
|
||||
SET @bug51650 = 1;
|
||||
INSERT IGNORE INTO t2 SET a = '777';
|
||||
DROP TRIGGER trg1;
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.1 tests.
|
||||
#
|
||||
# Bug#34453 Can't change size of file (Errcode: 1224)
|
||||
|
|
|
@ -517,7 +517,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select '1' AS `id`,'2007-04-25 18:30:22' AS `cur_date` from dual where <in_optimizer>('1',<exists>(select 1 AS `Not_used` from `test`.`t1` `x1` where 0))
|
||||
Note 1003 select '1' AS `id`,'2007-04-25 18:30:22' AS `cur_date` from dual where <in_optimizer>('1',<exists>(select 1 from `test`.`t1` `x1` where 0))
|
||||
select * from t1
|
||||
where id in (select id from t1 as x1 where (t1.cur_date is null));
|
||||
id cur_date
|
||||
|
@ -529,7 +529,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select '1' AS `id`,'2007-04-25' AS `cur_date` from dual where <in_optimizer>('1',<exists>(select 1 AS `Not_used` from `test`.`t2` `x1` where 0))
|
||||
Note 1003 select '1' AS `id`,'2007-04-25' AS `cur_date` from dual where <in_optimizer>('1',<exists>(select 1 from `test`.`t2` `x1` where 0))
|
||||
select * from t2
|
||||
where id in (select id from t2 as x1 where (t2.cur_date is null));
|
||||
id cur_date
|
||||
|
@ -543,7 +543,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY x1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`id`,<exists>(select 1 AS `Not_used` from `test`.`t1` `x1` where ((`test`.`t1`.`cur_date` = 0) and (<cache>(`test`.`t1`.`id`) = `test`.`x1`.`id`))))
|
||||
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`id`,<exists>(select 1 from `test`.`t1` `x1` where ((`test`.`t1`.`cur_date` = 0) and (<cache>(`test`.`t1`.`id`) = `test`.`x1`.`id`))))
|
||||
select * from t1
|
||||
where id in (select id from t1 as x1 where (t1.cur_date is null));
|
||||
id cur_date
|
||||
|
@ -555,7 +555,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
2 DEPENDENT SUBQUERY x1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `Not_used` from `test`.`t2` `x1` where ((`test`.`t2`.`cur_date` = 0) and (<cache>(`test`.`t2`.`id`) = `test`.`x1`.`id`))))
|
||||
Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 from `test`.`t2` `x1` where ((`test`.`t2`.`cur_date` = 0) and (<cache>(`test`.`t2`.`id`) = `test`.`x1`.`id`))))
|
||||
select * from t2
|
||||
where id in (select id from t2 as x1 where (t2.cur_date is null));
|
||||
id cur_date
|
||||
|
|
|
@ -1636,7 +1636,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (select `test`.`t1`.`a` AS `a` from `test`.`t2` where (`test`.`t2`.`b` = 12))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (select `test`.`t1`.`a` from `test`.`t2` where (`test`.`t2`.`b` = 12))
|
||||
# Should not crash
|
||||
SELECT * FROM t1 UNION SELECT * FROM t1
|
||||
ORDER BY (SELECT a FROM t2 WHERE b = 12);
|
||||
|
|
|
@ -514,3 +514,16 @@ ALTER TABLE t2 COMMENT = 'ABC';
|
|||
UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
|
||||
ALTER TABLE t2 COMMENT = 'DEF';
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#50545: Single table UPDATE IGNORE crashes on join view in
|
||||
# sql_safe_updates mode.
|
||||
#
|
||||
CREATE TABLE t1 ( a INT, KEY( a ) );
|
||||
INSERT INTO t1 VALUES (0), (1);
|
||||
CREATE VIEW v1 AS SELECT t11.a, t12.a AS b FROM t1 t11, t1 t12;
|
||||
SET SESSION sql_safe_updates = 1;
|
||||
UPDATE IGNORE v1 SET a = 1;
|
||||
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
|
||||
SET SESSION sql_safe_updates = DEFAULT;
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
|
|
|
@ -717,7 +717,7 @@ create view v1 as select a from t1;
|
|||
create view v2 as select a from t2 where a in (select a from v1);
|
||||
show create view v2;
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` in (select `v1`.`a` AS `a` from `v1`) latin1 latin1_swedish_ci
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` in (select `v1`.`a` from `v1`) latin1 latin1_swedish_ci
|
||||
drop view v2, v1;
|
||||
drop table t1, t2;
|
||||
CREATE VIEW `v 1` AS select 5 AS `5`;
|
||||
|
@ -2982,7 +2982,7 @@ SHOW WARNINGS;
|
|||
Level Code Message
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk` from (`t1` join `t2` on(((`t2`.`fk` = `t1`.`pk`) and (`t2`.`ver` = (select max(`t`.`ver`) AS `MAX(t.ver)` from `t2` `t` where (`t`.`org` = `t2`.`org`)))))) latin1 latin1_swedish_ci
|
||||
v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk` from (`t1` join `t2` on(((`t2`.`fk` = `t1`.`pk`) and (`t2`.`ver` = (select max(`t`.`ver`) from `t2` `t` where (`t`.`org` = `t2`.`org`)))))) latin1 latin1_swedish_ci
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1, t2;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
|
|
111
mysql-test/r/view_alias.result
Normal file
111
mysql-test/r/view_alias.result
Normal file
|
@ -0,0 +1,111 @@
|
|||
#
|
||||
# Bug#40277 SHOW CREATE VIEW returns invalid SQL
|
||||
# Bug#41999 SHOW CREATE VIEW returns invalid SQL if subquery is used in SELECT list
|
||||
#
|
||||
# 65 characters exceed the maximum length of a column identifier. The system cannot derive the name from statement.
|
||||
# Constant with length = 65 . Expect to get the identifier 'Name_exp_1'.
|
||||
CREATE VIEW v1 AS SELECT '<--- 65 char including the arrows --->';
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
COLUMN_NAME
|
||||
Name_exp_1
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select '<--- 65 char including the arrows --->' AS `Name_exp_1`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select '<--- 65 char including the arrows --->' AS `Name_exp_1`;
|
||||
DROP VIEW v1;
|
||||
# Subquery with length = 65 . Expect to get the identifier 'Name_exp_1'.
|
||||
# Attention: Identifier for the column within the subquery will be not generated.
|
||||
CREATE VIEW v1 AS SELECT (SELECT '<--- 54 char including the arrows (+ 11 outside) -->');
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
COLUMN_NAME
|
||||
Name_exp_1
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select (select '<--- 54 char including the arrows (+ 11 outside) -->') AS `Name_exp_1`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select (select '<--- 54 char including the arrows (+ 11 outside) -->') AS `Name_exp_1`;
|
||||
DROP VIEW v1;
|
||||
# -----------------------------------------------------------------------------------------------------------------
|
||||
# 64 characters are the maximum length of a column identifier. The system can derive the name from the statement.
|
||||
CREATE VIEW v1 AS SELECT '<--- 64 char including the arrows --->';
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
COLUMN_NAME
|
||||
<--- 64 char including the arrows --->
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select '<--- 64 char including the arrows --->' AS `<--- 64 char including the arrows --->`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select '<--- 64 char including the arrows --->' AS `<--- 64 char including the arrows --->`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS SELECT (SELECT '<--- 53 char including the arrows (+ 11 outside) --->');
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
COLUMN_NAME
|
||||
(SELECT '<--- 53 char including the arrows (+ 11 outside) --->')
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select (select '<--- 53 char including the arrows (+ 11 outside) --->') AS `(SELECT '<--- 53 char including the arrows (+ 11 outside) --->')`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select (select '<--- 53 char including the arrows (+ 11 outside) --->') AS `(SELECT '<--- 53 char including the arrows (+ 11 outside) --->')`;
|
||||
DROP VIEW v1;
|
||||
# -----------------------------------------------------------------------------------------------------------------
|
||||
# Identifiers must not have trailing spaces. The system cannot derive the name from a constant with trailing space.
|
||||
# Generated identifiers have at their end the position within the select column list.
|
||||
# 'c2 ' -> 'Name_exp_1' , ' c4 ' -> 'Name_exp_2'
|
||||
CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 ';
|
||||
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1';
|
||||
COLUMN_NAME
|
||||
c1
|
||||
Name_exp_2
|
||||
c3
|
||||
Name_exp_4
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select 'c1' AS `c1`,'c2 ' AS `Name_exp_2`,' c3' AS `c3`,' c4 ' AS `Name_exp_4`;
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select 'c1' AS `c1`,'c2 ' AS `Name_exp_2`,' c3' AS `c3`,' c4 ' AS `Name_exp_4`;
|
||||
DROP VIEW v1;
|
||||
#
|
||||
# Bug#40277 SHOW CREATE VIEW returns invalid SQL
|
||||
#
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
# Column name exceeds the maximum length.
|
||||
CREATE VIEW v1 AS SELECT '0000000000 1111111111 2222222222 3333333333 4444444444 5555555555';
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select '0000000000 1111111111 2222222222 3333333333 4444444444 5555555555' AS `Name_exp_1`;
|
||||
DROP VIEW v1;
|
||||
# Column names with leading trailing spaces.
|
||||
CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 ';
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select 'c1' AS `c1`,'c2 ' AS `Name_exp_2`,' c3' AS `c3`,' c4 ' AS `Name_exp_4`;
|
||||
DROP VIEW v1;
|
||||
# Column name conflicts with a auto-generated one.
|
||||
CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 ', 'Name_exp_2';
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select 'c1' AS `c1`,'c2 ' AS `Name_exp_2`,' c3' AS `c3`,' c4 ' AS `Name_exp_4`,'Name_exp_2' AS `My_exp_Name_exp_2`;
|
||||
DROP VIEW v1;
|
||||
# Invalid conlumn name in subquery.
|
||||
CREATE VIEW v1 AS SELECT (SELECT ' c1 ');
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select (select ' c1 ') AS `(SELECT ' c1 ')`;
|
||||
DROP VIEW v1;
|
||||
CREATE TABLE t1(a INT);
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
# Test alias in subquery
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT 1 FROM t2 AS b WHERE b.a = 0);
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select 1 from `test`.`t2` `b` where (`b`.`a` = 0));
|
||||
DROP VIEW v1;
|
||||
# Test column alias in subquery
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT a AS alias FROM t1 GROUP BY alias);
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where exists(select `t1`.`a` AS `alias` from `t1` group by `t1`.`a`) latin1 latin1_swedish_ci
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select `test`.`t1`.`a` AS `alias` from `test`.`t1` group by `test`.`t1`.`a`);
|
||||
DROP VIEW v1;
|
||||
# Alias as the expression column name.
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT ' a ' AS alias FROM t1 GROUP BY alias);
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where exists(select ' a ' AS `alias` from `t1` group by ' a ') latin1 latin1_swedish_ci
|
||||
DROP VIEW v1;
|
||||
CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select ' a ' AS `alias` from `test`.`t1` group by ' a ');
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1, t2;
|
|
@ -74,6 +74,23 @@ ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was det
|
|||
xa rollback 'a','c';
|
||||
xa start 'a','c';
|
||||
drop table t1;
|
||||
#
|
||||
# BUG#51342 - more xid crashing
|
||||
#
|
||||
CREATE TABLE t1(a INT) ENGINE=InnoDB;
|
||||
XA START 'x';
|
||||
SET SESSION autocommit=0;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SET SESSION autocommit=1;
|
||||
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
|
||||
SELECT @@autocommit;
|
||||
@@autocommit
|
||||
0
|
||||
INSERT INTO t1 VALUES(1);
|
||||
XA END 'x';
|
||||
XA COMMIT 'x' ONE PHASE;
|
||||
DROP TABLE t1;
|
||||
SET SESSION autocommit=1;
|
||||
End of 5.0 tests
|
||||
xa start 'a';
|
||||
xa end 'a';
|
||||
|
|
BIN
mysql-test/std_data/bug48265.frm
Normal file
BIN
mysql-test/std_data/bug48265.frm
Normal file
Binary file not shown.
|
@ -29,3 +29,32 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
|
|||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
drop table t1;
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 LIKE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
DROP TABLE t1;
|
||||
###############################################
|
||||
### assertion: No event for 'TRUNCATE TABLE t2'
|
||||
###############################################
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
###############################################
|
||||
RESET MASTER;
|
||||
CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
TRUNCATE t1;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
###############################################
|
||||
### assertion: No event for 'TRUNCATE TABLE t1'
|
||||
###############################################
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
###############################################
|
||||
|
|
|
@ -413,7 +413,6 @@ master-bin.000001 # Query # # BEGIN
|
|||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
|
|
|
@ -29,3 +29,14 @@ a
|
|||
6
|
||||
8
|
||||
drop table foo;
|
||||
RESET MASTER;
|
||||
create database b51226;
|
||||
use b51226;
|
||||
create temporary table t1(i int);
|
||||
use b51226;
|
||||
create temporary table t1(i int);
|
||||
create temporary table t1(i int);
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
insert into t1 values(1);
|
||||
DROP DATABASE b51226;
|
||||
FLUSH LOGS;
|
||||
|
|
|
@ -40,3 +40,40 @@ commit;
|
|||
source include/show_binlog_events.inc;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#51251
|
||||
#
|
||||
# The test case checks if truncating a temporary table created with
|
||||
# engine InnoDB will not cause the truncate statement to be binlogged.
|
||||
|
||||
# Before patch for BUG#51251, the TRUNCATE statements below would be
|
||||
# binlogged, which would cause the slave to fail with "table does not
|
||||
# exist".
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 LIKE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo ###############################################
|
||||
-- echo ### assertion: No event for 'TRUNCATE TABLE t2'
|
||||
-- echo ###############################################
|
||||
-- source include/show_binlog_events.inc
|
||||
-- echo ###############################################
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
TRUNCATE t1;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
|
||||
-- echo ###############################################
|
||||
-- echo ### assertion: No event for 'TRUNCATE TABLE t1'
|
||||
-- echo ###############################################
|
||||
-- source include/show_binlog_events.inc
|
||||
-- echo ###############################################
|
||||
|
|
|
@ -82,3 +82,69 @@ select * from foo;
|
|||
|
||||
# clean up
|
||||
drop table foo;
|
||||
|
||||
#################################################################
|
||||
# BUG#51226
|
||||
#################################################################
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
-- let $dbname=b51226
|
||||
|
||||
connect (con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connect (con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
|
||||
#
|
||||
# action: on con1 create the database and the tmp table
|
||||
#
|
||||
-- connection con1
|
||||
-- eval create database $dbname
|
||||
-- eval use $dbname
|
||||
create temporary table t1(i int);
|
||||
|
||||
#
|
||||
# action: on con1 create the tmp table
|
||||
#
|
||||
-- connection con2
|
||||
-- eval use $dbname
|
||||
create temporary table t1(i int);
|
||||
|
||||
# action: at this point, the last event binlogged contains the
|
||||
# pseudo_thread_id from con2. So now we switch to con1, issue
|
||||
# a statement that fails and close the connection (which logs
|
||||
# implicitely a DROP TEMPORARY TABLE).
|
||||
#
|
||||
# Before the patch this would not log con1's pseudo_thread_id
|
||||
# because the failing statement would reset THD context
|
||||
# (unsetting the thread_specific_used flag, and consequently,
|
||||
# causing the DROP event to be logged without pseudo_thread_id
|
||||
# in its header).
|
||||
|
||||
-- connection con1
|
||||
-- error 1050
|
||||
create temporary table t1(i int);
|
||||
-- disconnect con1
|
||||
|
||||
-- connection default
|
||||
-- let $wait_binlog_event= DROP
|
||||
-- source include/wait_for_binlog_event.inc
|
||||
|
||||
# action: insert in the t1. This would cause the the test to fail,
|
||||
# because when replaying the binlog the previous implicit drop
|
||||
# temp table would have been executed under the wrong
|
||||
# pseudo_thread_id, dropping the tmp table on con2.
|
||||
-- connection con2
|
||||
insert into t1 values(1);
|
||||
-- disconnect con2
|
||||
|
||||
-- connection default
|
||||
-- let $wait_binlog_event= DROP
|
||||
-- source include/wait_for_binlog_event.inc
|
||||
|
||||
-- eval DROP DATABASE $dbname
|
||||
FLUSH LOGS;
|
||||
|
||||
# assertion: assert that when replaying the binary log will succeed,
|
||||
# instead of failing with "Table 'XXX.YYY' doesn't exist"
|
||||
-- let $MYSQLD_DATADIR= `select @@datadir`
|
||||
-- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL
|
||||
|
|
|
@ -902,4 +902,28 @@ SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1
|
|||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #51357: crash when using handler commands on spatial indexes
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1(a GEOMETRY NOT NULL,SPATIAL INDEX a(a));
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ a FIRST;
|
||||
HANDLER t1 READ a NEXT;
|
||||
HANDLER t1 READ a PREV;
|
||||
HANDLER t1 READ a LAST;
|
||||
HANDLER t1 CLOSE;
|
||||
|
||||
#TODO: re-enable this test please when bug #51877 is solved
|
||||
# second crash fixed when the tree has changed since the last search.
|
||||
#HANDLER t1 OPEN;
|
||||
#HANDLER t1 READ a FIRST;
|
||||
#INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||
#HANDLER t1 READ a NEXT;
|
||||
#HANDLER t1 CLOSE;
|
||||
#TODO: end of the 51877 dependent section
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
|
|
@ -7,6 +7,8 @@ drop table if exists t1,t2,t3,t4,t5,t6;
|
|||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
create table t1 (a int not null primary key auto_increment, message char(20));
|
||||
create table t2 (a int not null primary key auto_increment, message char(20));
|
||||
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1");
|
||||
|
@ -1633,6 +1635,61 @@ SHOW CREATE TRIGGER tr1;
|
|||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#48265 - MRG_MYISAM problem (works in 5.0.85, does't work in 5.1.40)
|
||||
--echo #
|
||||
CREATE DATABASE `test/1`;
|
||||
|
||||
CREATE TABLE `test/1`.`t/1`(a INT);
|
||||
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM m1;
|
||||
SHOW CREATE TABLE m1;
|
||||
DROP TABLE m1;
|
||||
|
||||
CREATE TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM `test/1`.m1;
|
||||
SHOW CREATE TABLE `test/1`.m1;
|
||||
DROP TABLE `test/1`.m1;
|
||||
DROP TABLE `test/1`.`t/1`;
|
||||
|
||||
CREATE TEMPORARY TABLE `test/1`.`t/1`(a INT);
|
||||
CREATE TEMPORARY TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM m1;
|
||||
SHOW CREATE TABLE m1;
|
||||
DROP TABLE m1;
|
||||
|
||||
CREATE TEMPORARY TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM `test/1`.m1;
|
||||
SHOW CREATE TABLE `test/1`.m1;
|
||||
DROP TABLE `test/1`.m1;
|
||||
DROP TABLE `test/1`.`t/1`;
|
||||
|
||||
DROP DATABASE `test/1`;
|
||||
|
||||
# Test compatibility. Use '@' instead of '/' (was not allowed in 5.0)
|
||||
|
||||
CREATE TABLE `t@1`(a INT);
|
||||
copy_file std_data/bug48265.frm $MYSQLD_DATADIR/test/m1.frm;
|
||||
write_file $MYSQLD_DATADIR/test/m1.MRG;
|
||||
t@1
|
||||
EOF
|
||||
SELECT * FROM m1;
|
||||
SHOW CREATE TABLE m1;
|
||||
DROP TABLE `t@1`;
|
||||
|
||||
CREATE DATABASE `test@1`;
|
||||
CREATE TABLE `test@1`.`t@1`(a INT);
|
||||
FLUSH TABLE m1;
|
||||
remove_file $MYSQLD_DATADIR/test/m1.MRG;
|
||||
write_file $MYSQLD_DATADIR/test/m1.MRG;
|
||||
./test@1/t@1
|
||||
EOF
|
||||
SELECT * FROM m1;
|
||||
SHOW CREATE TABLE m1;
|
||||
DROP TABLE m1;
|
||||
DROP TABLE `test@1`.`t@1`;
|
||||
DROP DATABASE `test@1`;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
--echo #
|
||||
|
|
|
@ -1603,4 +1603,32 @@ CHECKSUM TABLE t2 EXTENDED;
|
|||
CHECKSUM TABLE t3 EXTENDED;
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#51307 - widespread corruption with partitions and insert...select
|
||||
--echo #
|
||||
CREATE TABLE t1(a CHAR(255), KEY(a));
|
||||
SELECT * FROM t1, t1 AS a1;
|
||||
SET myisam_sort_buffer_size=4;
|
||||
INSERT INTO t1 VALUES
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0');
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
INSERT INTO t1 VALUES('1');
|
||||
SELECT * FROM t1, t1 AS a1 WHERE t1.a=1 AND a1.a=1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -2396,6 +2396,36 @@ SELECT * FROM t2;
|
|||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#51650 crash with user variables and triggers
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
DROP TRIGGER IF EXISTS trg1;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (b VARCHAR(50) NOT NULL);
|
||||
CREATE TABLE t2 (a VARCHAR(10) NOT NULL DEFAULT '');
|
||||
|
||||
delimiter //;
|
||||
CREATE TRIGGER trg1 AFTER INSERT ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
SELECT 1 FROM t1 c WHERE
|
||||
(@bug51650 IS NULL OR @bug51650 != c.b) AND c.b = NEW.a LIMIT 1 INTO @foo;
|
||||
END//
|
||||
delimiter ;//
|
||||
|
||||
SET @bug51650 = 1;
|
||||
INSERT IGNORE INTO t2 VALUES();
|
||||
INSERT IGNORE INTO t1 SET b = '777';
|
||||
INSERT IGNORE INTO t2 SET a = '111';
|
||||
SET @bug51650 = 1;
|
||||
INSERT IGNORE INTO t2 SET a = '777';
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.1 tests.
|
||||
|
||||
|
||||
|
|
|
@ -467,3 +467,19 @@ UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
|
|||
ALTER TABLE t2 COMMENT = 'DEF';
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#50545: Single table UPDATE IGNORE crashes on join view in
|
||||
--echo # sql_safe_updates mode.
|
||||
--echo #
|
||||
CREATE TABLE t1 ( a INT, KEY( a ) );
|
||||
INSERT INTO t1 VALUES (0), (1);
|
||||
CREATE VIEW v1 AS SELECT t11.a, t12.a AS b FROM t1 t11, t1 t12;
|
||||
SET SESSION sql_safe_updates = 1;
|
||||
|
||||
--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
|
||||
UPDATE IGNORE v1 SET a = 1;
|
||||
|
||||
SET SESSION sql_safe_updates = DEFAULT;
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
|
|
92
mysql-test/t/view_alias.test
Normal file
92
mysql-test/t/view_alias.test
Normal file
|
@ -0,0 +1,92 @@
|
|||
--echo #
|
||||
--echo # Bug#40277 SHOW CREATE VIEW returns invalid SQL
|
||||
--echo # Bug#41999 SHOW CREATE VIEW returns invalid SQL if subquery is used in SELECT list
|
||||
--echo #
|
||||
|
||||
--echo # 65 characters exceed the maximum length of a column identifier. The system cannot derive the name from statement.
|
||||
--echo # Constant with length = 65 . Expect to get the identifier 'Name_exp_1'.
|
||||
let $after_select= '<--- 65 char including the arrows --->';
|
||||
--source include/view_alias.inc
|
||||
--echo # Subquery with length = 65 . Expect to get the identifier 'Name_exp_1'.
|
||||
--echo # Attention: Identifier for the column within the subquery will be not generated.
|
||||
let $after_select= (SELECT '<--- 54 char including the arrows (+ 11 outside) -->');
|
||||
--source include/view_alias.inc
|
||||
--echo # -----------------------------------------------------------------------------------------------------------------
|
||||
#
|
||||
--echo # 64 characters are the maximum length of a column identifier. The system can derive the name from the statement.
|
||||
let $after_select= '<--- 64 char including the arrows --->';
|
||||
--source include/view_alias.inc
|
||||
let $after_select= (SELECT '<--- 53 char including the arrows (+ 11 outside) --->');
|
||||
--source include/view_alias.inc
|
||||
--echo # -----------------------------------------------------------------------------------------------------------------
|
||||
#
|
||||
--echo # Identifiers must not have trailing spaces. The system cannot derive the name from a constant with trailing space.
|
||||
--echo # Generated identifiers have at their end the position within the select column list.
|
||||
--echo # 'c2 ' -> 'Name_exp_1' , ' c4 ' -> 'Name_exp_2'
|
||||
let $after_select= 'c1', 'c2 ', ' c3', ' c4 ';
|
||||
--source include/view_alias.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug#40277 SHOW CREATE VIEW returns invalid SQL
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
--echo # Column name exceeds the maximum length.
|
||||
CREATE VIEW v1 AS SELECT '0000000000 1111111111 2222222222 3333333333 4444444444 5555555555';
|
||||
let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
|
||||
DROP VIEW v1;
|
||||
eval CREATE VIEW v1 AS $query;
|
||||
DROP VIEW v1;
|
||||
|
||||
--echo # Column names with leading trailing spaces.
|
||||
CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 ';
|
||||
let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
|
||||
DROP VIEW v1;
|
||||
eval CREATE VIEW v1 AS $query;
|
||||
DROP VIEW v1;
|
||||
|
||||
--echo # Column name conflicts with a auto-generated one.
|
||||
CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 ', 'Name_exp_2';
|
||||
let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
|
||||
DROP VIEW v1;
|
||||
eval CREATE VIEW v1 AS $query;
|
||||
DROP VIEW v1;
|
||||
|
||||
--echo # Invalid conlumn name in subquery.
|
||||
CREATE VIEW v1 AS SELECT (SELECT ' c1 ');
|
||||
let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
|
||||
DROP VIEW v1;
|
||||
eval CREATE VIEW v1 AS $query;
|
||||
DROP VIEW v1;
|
||||
|
||||
CREATE TABLE t1(a INT);
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
|
||||
--echo # Test alias in subquery
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT 1 FROM t2 AS b WHERE b.a = 0);
|
||||
let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
|
||||
DROP VIEW v1;
|
||||
eval CREATE VIEW v1 AS $query;
|
||||
DROP VIEW v1;
|
||||
|
||||
--echo # Test column alias in subquery
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT a AS alias FROM t1 GROUP BY alias);
|
||||
SHOW CREATE VIEW v1;
|
||||
let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
|
||||
DROP VIEW v1;
|
||||
eval CREATE VIEW v1 AS $query;
|
||||
DROP VIEW v1;
|
||||
|
||||
--echo # Alias as the expression column name.
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT ' a ' AS alias FROM t1 GROUP BY alias);
|
||||
SHOW CREATE VIEW v1;
|
||||
let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
|
||||
DROP VIEW v1;
|
||||
eval CREATE VIEW v1 AS $query;
|
||||
DROP VIEW v1;
|
||||
|
||||
DROP TABLE t1, t2;
|
|
@ -122,6 +122,22 @@ xa start 'a','c';
|
|||
--connection default
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#51342 - more xid crashing
|
||||
--echo #
|
||||
CREATE TABLE t1(a INT) ENGINE=InnoDB;
|
||||
XA START 'x';
|
||||
SET SESSION autocommit=0;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
--error ER_XAER_RMFAIL
|
||||
SET SESSION autocommit=1;
|
||||
SELECT @@autocommit;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
XA END 'x';
|
||||
XA COMMIT 'x' ONE PHASE;
|
||||
DROP TABLE t1;
|
||||
SET SESSION autocommit=1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
|
|
@ -112,8 +112,7 @@ mysqlbug: ${top_builddir}/config.status mysqlbug.sh
|
|||
mysql_fix_privilege_tables.sql: mysql_system_tables.sql \
|
||||
mysql_system_tables_fix.sql
|
||||
@echo "Building $@";
|
||||
@cat $(srcdir)/mysql_system_tables.sql \
|
||||
$(srcdir)/mysql_system_tables_fix.sql > $@
|
||||
@cat mysql_system_tables.sql mysql_system_tables_fix.sql > $@
|
||||
|
||||
#
|
||||
# Build mysql_fix_privilege_tables_sql.c from
|
||||
|
@ -126,7 +125,7 @@ mysql_fix_privilege_tables_sql.c: comp_sql.c mysql_fix_privilege_tables.sql
|
|||
sleep 2
|
||||
$(top_builddir)/scripts/comp_sql$(EXEEXT) \
|
||||
mysql_fix_privilege_tables \
|
||||
$(top_builddir)/scripts/mysql_fix_privilege_tables.sql $@
|
||||
$(top_srcdir)/scripts/mysql_fix_privilege_tables.sql $@
|
||||
|
||||
|
||||
SUFFIXES = .sh
|
||||
|
|
|
@ -4642,6 +4642,7 @@ void Item_field::cleanup()
|
|||
I.e. we can drop 'field'.
|
||||
*/
|
||||
field= result_field= 0;
|
||||
item_equal= NULL;
|
||||
null_value= FALSE;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
|
|
@ -9484,7 +9484,7 @@ Incident_log_event::write_data_body(IO_CACHE *file)
|
|||
they will always be printed for the first event.
|
||||
*/
|
||||
st_print_event_info::st_print_event_info()
|
||||
:flags2_inited(0), sql_mode_inited(0),
|
||||
:flags2_inited(0), sql_mode_inited(0), sql_mode(0),
|
||||
auto_increment_increment(0),auto_increment_offset(0), charset_inited(0),
|
||||
lc_time_names_number(~0),
|
||||
charset_database_number(ILLEGAL_CHARSET_INFO_NUMBER),
|
||||
|
|
|
@ -3217,6 +3217,13 @@ static bool set_option_autocommit(THD *thd, set_var *var)
|
|||
if ((org_options & OPTION_NOT_AUTOCOMMIT))
|
||||
{
|
||||
/* We changed to auto_commit mode */
|
||||
if (thd->transaction.xid_state.xa_state != XA_NOTR)
|
||||
{
|
||||
thd->options= org_options;
|
||||
my_error(ER_XAER_RMFAIL, MYF(0),
|
||||
xa_state_names[thd->transaction.xid_state.xa_state]);
|
||||
return 1;
|
||||
}
|
||||
thd->options&= ~(ulonglong) (OPTION_BEGIN | OPTION_KEEP_LOG);
|
||||
thd->transaction.all.modified_non_trans_table= FALSE;
|
||||
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
|
||||
|
|
|
@ -22,7 +22,7 @@ dist-hook:
|
|||
test -d $(distdir)/$$dir || mkdir $(distdir)/$$dir; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$dir/*.* $(distdir)/$$dir; \
|
||||
done; \
|
||||
sleep 1 ; touch $(builddir)/*/errmsg.sys
|
||||
sleep 1 ; touch $(srcdir)/*/errmsg.sys
|
||||
$(INSTALL_DATA) $(srcdir)/charsets/README $(distdir)/charsets
|
||||
$(INSTALL_DATA) $(srcdir)/charsets/Index.xml $(distdir)/charsets
|
||||
|
||||
|
@ -39,11 +39,11 @@ install-data-local:
|
|||
for lang in @AVAILABLE_LANGUAGES@; \
|
||||
do \
|
||||
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$$lang; \
|
||||
$(INSTALL_DATA) $(builddir)/$$lang/errmsg.sys \
|
||||
$(INSTALL_DATA) $(srcdir)/$$lang/errmsg.sys \
|
||||
$(DESTDIR)$(pkgdatadir)/$$lang/errmsg.sys; \
|
||||
done
|
||||
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/charsets
|
||||
$(INSTALL_DATA) $(builddir)/errmsg-utf8.txt \
|
||||
$(INSTALL_DATA) $(srcdir)/errmsg-utf8.txt \
|
||||
$(DESTDIR)$(pkgdatadir)/errmsg-utf8.txt; \
|
||||
$(INSTALL_DATA) $(srcdir)/charsets/README $(DESTDIR)$(pkgdatadir)/charsets/README
|
||||
$(INSTALL_DATA) $(srcdir)/charsets/*.xml $(DESTDIR)$(pkgdatadir)/charsets
|
||||
|
@ -53,7 +53,7 @@ uninstall-local:
|
|||
@RM@ -f -r $(DESTDIR)$(pkgdatadir)
|
||||
|
||||
distclean-local:
|
||||
@RM@ -f $(builddir)/*/errmsg.sys
|
||||
@RM@ -f */errmsg.sys
|
||||
|
||||
# Do nothing
|
||||
link_sources:
|
||||
|
|
|
@ -1523,6 +1523,7 @@ void close_temporary_tables(THD *thd)
|
|||
{
|
||||
if (is_user_table(table))
|
||||
{
|
||||
bool save_thread_specific_used= thd->thread_specific_used;
|
||||
my_thread_id save_pseudo_thread_id= thd->variables.pseudo_thread_id;
|
||||
/* Set pseudo_thread_id to be that of the processed table */
|
||||
thd->variables.pseudo_thread_id= tmpkeyval(thd, table);
|
||||
|
@ -1552,6 +1553,7 @@ void close_temporary_tables(THD *thd)
|
|||
thd->clear_error();
|
||||
CHARSET_INFO *cs_save= thd->variables.character_set_client;
|
||||
thd->variables.character_set_client= system_charset_info;
|
||||
thd->thread_specific_used= TRUE;
|
||||
Query_log_event qinfo(thd, s_query.ptr(),
|
||||
s_query.length() - 1 /* to remove trailing ',' */,
|
||||
0, FALSE, 0);
|
||||
|
@ -1564,6 +1566,7 @@ void close_temporary_tables(THD *thd)
|
|||
"Failed to write the DROP statement for temporary tables to binary log");
|
||||
}
|
||||
thd->variables.pseudo_thread_id= save_pseudo_thread_id;
|
||||
thd->thread_specific_used= save_thread_specific_used;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -50,6 +50,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
|||
SELECT_LEX *select_lex= &thd->lex->select_lex;
|
||||
THD::killed_state killed_status= THD::NOT_KILLED;
|
||||
DBUG_ENTER("mysql_delete");
|
||||
bool save_binlog_row_based;
|
||||
|
||||
THD::enum_binlog_query_type query_type=
|
||||
thd->lex->sql_command == SQLCOM_TRUNCATE ?
|
||||
|
@ -147,12 +148,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
|||
query_type= THD::STMT_QUERY_TYPE;
|
||||
error= -1; // ok
|
||||
deleted= maybe_deleted;
|
||||
save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
goto cleanup;
|
||||
}
|
||||
if (error != HA_ERR_WRONG_COMMAND)
|
||||
{
|
||||
table->file->print_error(error,MYF(0));
|
||||
error=0;
|
||||
save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
goto cleanup;
|
||||
}
|
||||
/* Handler didn't support fast delete; Delete rows one by one */
|
||||
|
@ -293,6 +296,11 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
|||
|
||||
table->mark_columns_needed_for_delete();
|
||||
|
||||
save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
if (thd->lex->sql_command == SQLCOM_TRUNCATE &&
|
||||
thd->current_stmt_binlog_row_based)
|
||||
thd->clear_current_stmt_binlog_row_based();
|
||||
|
||||
while (!(error=info.read_record(&info)) && !thd->killed &&
|
||||
! thd->is_error())
|
||||
{
|
||||
|
@ -390,7 +398,10 @@ cleanup:
|
|||
/* See similar binlogging code in sql_update.cc, for comments */
|
||||
if ((error < 0) || thd->transaction.stmt.modified_non_trans_table)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open() &&
|
||||
!(thd->lex->sql_command == SQLCOM_TRUNCATE &&
|
||||
thd->current_stmt_binlog_row_based &&
|
||||
find_temporary_table(thd, table_list)))
|
||||
{
|
||||
bool const is_trans=
|
||||
thd->lex->sql_command == SQLCOM_TRUNCATE ?
|
||||
|
@ -424,6 +435,7 @@ cleanup:
|
|||
if (thd->transaction.stmt.modified_non_trans_table)
|
||||
thd->transaction.all.modified_non_trans_table= TRUE;
|
||||
}
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table);
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
if (error < 0 ||
|
||||
|
@ -1059,15 +1071,13 @@ bool multi_delete::send_eof()
|
|||
|
||||
static bool mysql_truncate_by_delete(THD *thd, TABLE_LIST *table_list)
|
||||
{
|
||||
bool error, save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
bool error;
|
||||
DBUG_ENTER("mysql_truncate_by_delete");
|
||||
table_list->lock_type= TL_WRITE;
|
||||
mysql_init_select(thd->lex);
|
||||
thd->clear_current_stmt_binlog_row_based();
|
||||
error= mysql_delete(thd, table_list, NULL, NULL, HA_POS_ERROR, LL(0), TRUE);
|
||||
ha_autocommit_or_rollback(thd, error);
|
||||
end_trans(thd, error ? ROLLBACK : COMMIT);
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
|
|
@ -17107,7 +17107,17 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
|
|||
first= 0;
|
||||
else
|
||||
str->append(',');
|
||||
item->print_item_w_name(str, query_type);
|
||||
|
||||
if (master_unit()->item && item->is_autogenerated_name)
|
||||
{
|
||||
/*
|
||||
Do not print auto-generated aliases in subqueries. It has no purpose
|
||||
in a view definition or other contexts where the query is printed.
|
||||
*/
|
||||
item->print(str, query_type);
|
||||
}
|
||||
else
|
||||
item->print_item_w_name(str, query_type);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -155,6 +155,35 @@ err:
|
|||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check if auto generated column names are conforming and
|
||||
possibly generate a conforming name for them if not.
|
||||
|
||||
@param item_list List of Items which should be checked
|
||||
*/
|
||||
|
||||
static void make_valid_column_names(List<Item> &item_list)
|
||||
{
|
||||
Item *item;
|
||||
uint name_len;
|
||||
List_iterator_fast<Item> it(item_list);
|
||||
char buff[NAME_LEN];
|
||||
DBUG_ENTER("make_valid_column_names");
|
||||
|
||||
for (uint column_no= 1; (item= it++); column_no++)
|
||||
{
|
||||
if (!item->is_autogenerated_name || !check_column_name(item->name))
|
||||
continue;
|
||||
name_len= my_snprintf(buff, NAME_LEN, "Name_exp_%u", column_no);
|
||||
item->orig_name= item->name;
|
||||
item->set_name(buff, name_len, system_charset_info);
|
||||
}
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Fill defined view parts
|
||||
|
||||
|
@ -548,6 +577,9 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
|||
}
|
||||
}
|
||||
|
||||
/* Check if the auto generated column names are conforming. */
|
||||
make_valid_column_names(select_lex->item_list);
|
||||
|
||||
if (check_duplicate_names(select_lex->item_list, 1))
|
||||
{
|
||||
res= TRUE;
|
||||
|
|
|
@ -1449,9 +1449,17 @@ int ha_myisam::enable_indexes(uint mode)
|
|||
{
|
||||
sql_print_warning("Warning: Enabling keys got errno %d on %s.%s, retrying",
|
||||
my_errno, param.db_name, param.table_name);
|
||||
/* Repairing by sort failed. Now try standard repair method. */
|
||||
param.testflag&= ~(T_REP_BY_SORT | T_QUICK);
|
||||
error= (repair(thd,param,0) != HA_ADMIN_OK);
|
||||
/*
|
||||
Repairing by sort failed. Now try standard repair method.
|
||||
Still we want to fix only index file. If data file corruption
|
||||
was detected (T_RETRY_WITHOUT_QUICK), we shouldn't do much here.
|
||||
Let implicit repair do this job.
|
||||
*/
|
||||
if (!(param.testflag & T_RETRY_WITHOUT_QUICK))
|
||||
{
|
||||
param.testflag&= ~T_REP_BY_SORT;
|
||||
error= (repair(thd,param,0) != HA_ADMIN_OK);
|
||||
}
|
||||
/*
|
||||
If the standard repair succeeded, clear all error messages which
|
||||
might have been set by the first repair. They can still be seen
|
||||
|
|
|
@ -404,10 +404,16 @@ int rtree_get_first(MI_INFO *info, uint keynr, uint key_length)
|
|||
|
||||
int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
|
||||
{
|
||||
my_off_t root;
|
||||
my_off_t root= info->s->state.key_root[keynr];
|
||||
MI_KEYDEF *keyinfo = info->s->keyinfo + keynr;
|
||||
|
||||
if (!info->buff_used)
|
||||
if (root == HA_OFFSET_ERROR)
|
||||
{
|
||||
my_errno= HA_ERR_END_OF_FILE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!info->buff_used && !info->page_changed)
|
||||
{
|
||||
uint k_len = keyinfo->keylength - info->s->base.rec_reflength;
|
||||
/* rt_PAGE_NEXT_KEY(info->int_keypos) */
|
||||
|
@ -428,16 +434,8 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
|
|||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
|
||||
{
|
||||
my_errno= HA_ERR_END_OF_FILE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return rtree_get_req(info, keyinfo, key_length, root, 0);
|
||||
}
|
||||
|
||||
return rtree_get_req(info, keyinfo, key_length, root, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -215,36 +215,14 @@ const char *ha_myisammrg::index_type(uint key_number)
|
|||
static int myisammrg_parent_open_callback(void *callback_param,
|
||||
const char *filename)
|
||||
{
|
||||
ha_myisammrg *ha_myrg;
|
||||
TABLE *parent;
|
||||
ha_myisammrg *ha_myrg= (ha_myisammrg*) callback_param;
|
||||
TABLE *parent= ha_myrg->table_ptr();
|
||||
TABLE_LIST *child_l;
|
||||
const char *db;
|
||||
const char *table_name;
|
||||
size_t dirlen;
|
||||
char dir_path[FN_REFLEN];
|
||||
char name_buf[NAME_LEN];
|
||||
DBUG_ENTER("myisammrg_parent_open_callback");
|
||||
|
||||
/* Extract child table name and database name from filename. */
|
||||
dirlen= dirname_length(filename);
|
||||
if (dirlen >= FN_REFLEN)
|
||||
{
|
||||
/* purecov: begin inspected */
|
||||
DBUG_PRINT("error", ("name too long: '%.64s'", filename));
|
||||
my_errno= ENAMETOOLONG;
|
||||
DBUG_RETURN(1);
|
||||
/* purecov: end */
|
||||
}
|
||||
table_name= filename + dirlen;
|
||||
dirlen--; /* Strip off trailing '/'. */
|
||||
memcpy(dir_path, filename, dirlen);
|
||||
dir_path[dirlen]= '\0';
|
||||
db= base_name(dir_path);
|
||||
dirlen-= db - dir_path; /* This is now the length of 'db'. */
|
||||
DBUG_PRINT("myrg", ("open: '%s'.'%s'", db, table_name));
|
||||
|
||||
ha_myrg= (ha_myisammrg*) callback_param;
|
||||
parent= ha_myrg->table_ptr();
|
||||
|
||||
/* Get a TABLE_LIST object. */
|
||||
if (!(child_l= (TABLE_LIST*) alloc_root(&parent->mem_root,
|
||||
sizeof(TABLE_LIST))))
|
||||
|
@ -256,13 +234,69 @@ static int myisammrg_parent_open_callback(void *callback_param,
|
|||
}
|
||||
bzero((char*) child_l, sizeof(TABLE_LIST));
|
||||
|
||||
/* Set database (schema) name. */
|
||||
child_l->db_length= dirlen;
|
||||
child_l->db= strmake_root(&parent->mem_root, db, dirlen);
|
||||
/* Set table name. */
|
||||
child_l->table_name_length= strlen(table_name);
|
||||
child_l->table_name= strmake_root(&parent->mem_root, table_name,
|
||||
child_l->table_name_length);
|
||||
/*
|
||||
Depending on MySQL version, filename may be encoded by table name to
|
||||
file name encoding or not. Always encoded if parent table is created
|
||||
by 5.1.46+. Encoded if parent is created by 5.1.6+ and child table is
|
||||
in different database.
|
||||
*/
|
||||
if (!has_path(filename))
|
||||
{
|
||||
/* Child is in the same database as parent. */
|
||||
child_l->db_length= parent->s->db.length;
|
||||
child_l->db= strmake_root(&parent->mem_root, parent->s->db.str,
|
||||
child_l->db_length);
|
||||
/* Child table name is encoded in parent dot-MRG starting with 5.1.46. */
|
||||
if (parent->s->mysql_version >= 50146)
|
||||
{
|
||||
child_l->table_name_length= filename_to_tablename(filename, name_buf,
|
||||
sizeof(name_buf));
|
||||
child_l->table_name= strmake_root(&parent->mem_root, name_buf,
|
||||
child_l->table_name_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
child_l->table_name_length= strlen(filename);
|
||||
child_l->table_name= strmake_root(&parent->mem_root, filename,
|
||||
child_l->table_name_length);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBUG_ASSERT(strlen(filename) < sizeof(dir_path));
|
||||
fn_format(dir_path, filename, "", "", 0);
|
||||
/* Extract child table name and database name from filename. */
|
||||
dirlen= dirname_length(dir_path);
|
||||
/* Child db/table name is encoded in parent dot-MRG starting with 5.1.6. */
|
||||
if (parent->s->mysql_version >= 50106)
|
||||
{
|
||||
child_l->table_name_length= filename_to_tablename(dir_path + dirlen,
|
||||
name_buf,
|
||||
sizeof(name_buf));
|
||||
child_l->table_name= strmake_root(&parent->mem_root, name_buf,
|
||||
child_l->table_name_length);
|
||||
dir_path[dirlen - 1]= 0;
|
||||
dirlen= dirname_length(dir_path);
|
||||
child_l->db_length= filename_to_tablename(dir_path + dirlen, name_buf,
|
||||
sizeof(name_buf));
|
||||
child_l->db= strmake_root(&parent->mem_root, name_buf, child_l->db_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
child_l->table_name_length= strlen(dir_path + dirlen);
|
||||
child_l->table_name= strmake_root(&parent->mem_root, dir_path + dirlen,
|
||||
child_l->table_name_length);
|
||||
dir_path[dirlen - 1]= 0;
|
||||
dirlen= dirname_length(dir_path);
|
||||
child_l->db_length= strlen(dir_path + dirlen);
|
||||
child_l->db= strmake_root(&parent->mem_root, dir_path + dirlen,
|
||||
child_l->db_length);
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", child_l->db_length, child_l->db,
|
||||
child_l->table_name_length, child_l->table_name));
|
||||
|
||||
/* Convert to lowercase if required. */
|
||||
if (lower_case_table_names && child_l->table_name_length)
|
||||
child_l->table_name_length= my_casedn_str(files_charset_info,
|
||||
|
@ -1155,7 +1189,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
|
|||
/* Create child path names. */
|
||||
for (pos= table_names; tables; tables= tables->next_local)
|
||||
{
|
||||
const char *table_name;
|
||||
const char *table_name= buff;
|
||||
|
||||
/*
|
||||
Construct the path to the MyISAM table. Try to meet two conditions:
|
||||
|
@ -1181,10 +1215,12 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
|
|||
as the MyISAM tables are from the same database as the MERGE table.
|
||||
*/
|
||||
if ((dirname_length(buff) == dirlgt) && ! memcmp(buff, name, dirlgt))
|
||||
table_name= tables->table_name;
|
||||
else
|
||||
if (! (table_name= thd->strmake(buff, length)))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* purecov: inspected */
|
||||
{
|
||||
table_name+= dirlgt;
|
||||
length-= dirlgt;
|
||||
}
|
||||
if (!(table_name= thd->strmake(table_name, length)))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* purecov: inspected */
|
||||
|
||||
*pos++= table_name;
|
||||
}
|
||||
|
@ -1205,7 +1241,7 @@ void ha_myisammrg::append_create_info(String *packet)
|
|||
const char *current_db;
|
||||
size_t db_length;
|
||||
THD *thd= current_thd;
|
||||
MYRG_TABLE *open_table, *first;
|
||||
TABLE_LIST *open_table, *first;
|
||||
|
||||
if (file->merge_insert_method != MERGE_INSERT_DISABLED)
|
||||
{
|
||||
|
@ -1223,14 +1259,11 @@ void ha_myisammrg::append_create_info(String *packet)
|
|||
current_db= table->s->db.str;
|
||||
db_length= table->s->db.length;
|
||||
|
||||
for (first=open_table=file->open_tables ;
|
||||
open_table != file->end_table ;
|
||||
open_table++)
|
||||
for (first= open_table= table->child_l;;
|
||||
open_table= open_table->next_global)
|
||||
{
|
||||
LEX_STRING db, name;
|
||||
LINT_INIT(db.str);
|
||||
LEX_STRING db= { open_table->db, open_table->db_length };
|
||||
|
||||
split_file_name(open_table->table->filename, &db, &name);
|
||||
if (open_table != first)
|
||||
packet->append(',');
|
||||
/* Report database for mapped table if it isn't in current database */
|
||||
|
@ -1241,7 +1274,10 @@ void ha_myisammrg::append_create_info(String *packet)
|
|||
append_identifier(thd, packet, db.str, db.length);
|
||||
packet->append('.');
|
||||
}
|
||||
append_identifier(thd, packet, name.str, name.length);
|
||||
append_identifier(thd, packet, open_table->table_name,
|
||||
open_table->table_name_length);
|
||||
if (&open_table->next_global == table->child_last_l)
|
||||
break;
|
||||
}
|
||||
packet->append(')');
|
||||
}
|
||||
|
|
|
@ -311,14 +311,6 @@ MYRG_INFO *myrg_parent_open(const char *parent_name,
|
|||
if (!child_name_buff[0] || (child_name_buff[0] == '#'))
|
||||
continue;
|
||||
|
||||
if (!has_path(child_name_buff))
|
||||
{
|
||||
VOID(strmake(parent_name_buff + dir_length, child_name_buff,
|
||||
sizeof(parent_name_buff) - 1 - dir_length));
|
||||
VOID(cleanup_dirname(child_name_buff, parent_name_buff));
|
||||
}
|
||||
else
|
||||
fn_format(child_name_buff, child_name_buff, "", "", 0);
|
||||
DBUG_PRINT("info", ("child: '%s'", child_name_buff));
|
||||
|
||||
/* Callback registers child with handler table. */
|
||||
|
|
|
@ -37,7 +37,7 @@ testBitmask_LDFLAGS = @ndb_bin_am_ldflags@ \
|
|||
|
||||
testBitmask.cpp : Bitmask.cpp
|
||||
rm -f testBitmask.cpp
|
||||
@LN_CP_F@ $(srcdir)/Bitmask.cpp testBitmask.cpp
|
||||
@LN_CP_F@ Bitmask.cpp testBitmask.cpp
|
||||
|
||||
testBitmask.o: $(testBitmask_SOURCES)
|
||||
$(CXXCOMPILE) -c $(INCLUDES) -D__TEST_BITMASK__ $<
|
||||
|
|
Loading…
Reference in a new issue