Matias Silva wrote:
Hi Everyone, I wrote a for loop to build several select
statements that are combined with a UNION. When I execute
one of the queries separately, it works, but when I execute
the query with a UNION it returns:
ERROR 2013 (HY000): Lost connection to MySQL server during query
I am able to run additional queries after I get the error, so
the connection is not lost. I have tried running the query
with the union on MySQL Query Browser and also on the
command prompt and I get the same results.
Here is my query:
SELECT DATE_ADD(units_next_bill, INTERVAL 0 MONTH), fees_name AS
Name, IF(fees_percent = 'T', IF(fees_round = 'T', ROUND(fees_amount *
units_pay_amount), ROUND(fees_amount * units_pay_amount, 2)),
fees_amount) AS Amount
FROM unit_dtl
INNER JOIN fees ON unit_dtl_name = fees_name AND unit_dtl.facilityID
= fees.facilityID AND fees_discount = 'T'
INNER JOIN units ON units.facilityID = unit_dtl.facilityID AND
units_unit_id = unit_dtl_unit_id
WHERE (unit_dtl.facilityID = 'matt1' AND unit_dtl_unit_id = 'A3' AND
unit_dtl_active = 'T') AND ((unit_dtl_expires = 'T' AND NOW() <
unit_dtl_exp_date) XOR (unit_dtl_expires = 'F'))
UNION
SELECT DATE_ADD(units_next_bill, INTERVAL 1 MONTH), fees_name AS
Name, IF(fees_percent = 'T', IF(fees_round = 'T', ROUND(fees_amount *
units_pay_amount), ROUND(fees_amount * units_pay_amount, 2)),
fees_amount) AS Amount
FROM unit_dtl
INNER JOIN fees ON unit_dtl_name = fees_name AND unit_dtl.facilityID
= fees.facilityID AND fees_discount = 'T'
INNER JOIN units ON units.facilityID = unit_dtl.facilityID AND
units_unit_id = unit_dtl_unit_id
WHERE (unit_dtl.facilityID = 'matt1' AND unit_dtl_unit_id = 'A3' AND
unit_dtl_active = 'T') AND ((unit_dtl_expires = 'T' AND NOW() <
unit_dtl_exp_date) XOR (unit_dtl_expires = 'F'))
I am using the MySQL (rpm version) 4.1.10a on a linux system
Linux nighthawk 2.4.21-27.0.2.ELsmp #1 SMP Wed Jan 12 23:35:44 EST 2005
i686 i686 i386 GNU/Linux
Any help would be appreciated.
Thanks,
Matt
Here' is the error log. There are some suggestions written
in the log on how to investigate this more in detail. I think
I will start by increasing the key_buffer_size.
mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.
key_buffer_size=268435456
read_buffer_size=1044480
max_used_connections=4
max_connections=100
threads_connected=3
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 466543 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
thd=0x8981378
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0xbfe3ec78, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x808d8d7
0x82e69f8
0x80888b8
0x8084e53
0x80c9eba
0x80c0a1a
0x80c0ee2
0x812f213
0x812d800
0x80bdfbc
0x809dbda
0x80a22d9
0x809c7c8
0x809c194
0x809b847
0x82e41ac
0x830da7a
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read
http://dev.mysql.com/doc/mysql/en/Us...ack_trace.html and follow instructions on how to resolve the
stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x89829e8 = SELECT DATE_ADD(units_next_bill, INTERVAL 0 MONTH) AS BillingDate, fees_name AS Name, IF(
fees_percent = 'T', IF(fees_round = 'T', ROUND(fees_amount * units_pay_amount), ROUND(fees_amount * units_pay_amoun
t, 2)), fees_amount) AS Amount FROM unit_dtl INNER JOIN fees ON unit_dtl_name = fees_name AND unit_dtl.facilityID =
fees.facilityID AND fees_discount = 'T' INNER JOIN units ON units.facilityID = unit_dtl.facilityID AND units_unit_
id = unit_dtl_unit_id WHERE (unit_dtl.facilityID = 'matt1' AND unit_dtl_unit_id = 'A3' AND unit_dtl_active = 'T') A
ND ((unit_dtl_expires = 'T' AND (DATE_ADD(units_next_bill, INTERVAL 0 MONTH) < unit_dtl_exp_date)) XOR (unit_dtl_ex
pires = 'F'))
UNION ALL
SELECT DATE_ADD(units_next_bill, INTERVAL 1 MONTH) AS BillingDate, fees_name AS Name, IF(fees_percent = 'T', IF(fee
s_round = 'T', ROUND(fees_amount * units_pay_amount), ROUND(fees_amount * units_pay_amount, 2)), fees_amount) AS Am
ount FROM unit_dtl INNER JOIN fees ON unit_dtl_name = fees_name AND unit_dtl.facilityID = fees.facilityI
thd->thread_id=156
The manual page at
http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.
Number of processes running now: 0
050413 10:34:17 mysqld restarted
050413 10:34:17 [Warning] Asked for 196608 thread stack, but got 126976
050413 10:34:17 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
050413 10:34:17 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: File name ./sunbelt
InnoDB: File operation call: 'stat'.
InnoDB: Error: os_file_readdir_next_file returned -1 in MySQL datadir
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
050413 10:34:17 InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 0 86479.
InnoDB: Doing recovery: scanned up to log sequence number 0 86479
InnoDB: Last MySQL binlog file position 0 79, file name ./nighthawk-bin.000083
050413 10:34:17 InnoDB: Flushing modified pages from the buffer pool...
050413 10:34:17 InnoDB: Started; log sequence number 0 86479
050413 10:34:17 [Warning] mysql.user table is not updated to new password format; Disabling new password usage unti
l mysql_fix_privilege_tables is run
/usr/sbin/mysqld: ready for connections.
Version: '4.1.10a-standard-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Edition - Standar
d (GPL)
(END)