MySQL NOW() function producing 0000-00-00 00:00:00

2006-08-25 Thread Jeremiah Foster
Hello all,

We are using an NOW() function in our database and occasionally it
produces odd results. There are entries where it states: -00-00
00:00:00 instead of the current time. Is this a bug, or are we using the
function incorrectly?

MySQL version info:
mysql  Ver 12.22 Distrib 4.0.26, for portbld-freebsd4.11 (i386)


Thank you,

Jeremiah


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQL NOW() function producing 0000-00-00 00:00:00

2006-08-25 Thread Renato Golin

Jeremiah Foster wrote:

Hello all,

We are using an NOW() function in our database and occasionally it
produces odd results. There are entries where it states: -00-00
00:00:00 instead of the current time. Is this a bug, or are we using the
function incorrectly?

MySQL version info:
mysql  Ver 12.22 Distrib 4.0.26, for portbld-freebsd4.11 (i386)


Hum, the little devil is playing you tricks, uh ?

It's easier that NOW() didn't run at all instead of producing Jesus' 
dates. Try a dummy insert on a dummy table just putting now() on a 
column and see if any of them gets out zero. If some does, it's a bug on 
MySQL, otherwise can be a problem while you're assembling your query.


mysql use test; create table foo (a datetime);

bash$ for ((i=1000; i; i--)); do echo insert into foo values 
(now()) | mysql test; done


myslq use test; select * from dates where a = -00-00 00:00:00;


Should return no results.

cheers,
--renato

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQL NOW() function producing 0000-00-00 00:00:00

2006-08-25 Thread Chris Knipe

We are using an NOW() function in our database and occasionally it
produces odd results. There are entries where it states: -00-00
00:00:00 instead of the current time. Is this a bug, or are we using the
function incorrectly?


After patiently injecting at about 400 queries per seconds, a couple of 
hours later, I had about 5 million records in a table.  Not a single one of 
them experienced the above


I'm pretty sure your -00-00 does not come from NOW()

--
Chris


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQL NOW() function producing 0000-00-00 00:00:00

2006-08-25 Thread Renato Golin

Chris Knipe wrote:
After patiently injecting at about 400 queries per seconds, a couple of 
hours later, I had about 5 million records in a table.  Not a single one 
of them experienced the above


It's one every 5 million and 1 entries... try again ;)

Also, maybe (very improbable) it can be the way you are using NOW() 
within the query. Can you show us the query ?


cheers,
--renato

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQL NOW() function producing 0000-00-00 00:00:00

2006-08-25 Thread Chris Knipe

Doh.. Wrong email ;)

INSERT INTO a VALUES (NOW()) ?


Regards,
Chris.

- Original Message - 
From: Renato Golin [EMAIL PROTECTED]

To: Chris Knipe [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com
Sent: Friday, August 25, 2006 4:30 PM
Subject: Re: MySQL NOW() function producing -00-00 00:00:00



Chris Knipe wrote:
After patiently injecting at about 400 queries per seconds, a couple of 
hours later, I had about 5 million records in a table.  Not a single one 
of them experienced the above


It's one every 5 million and 1 entries... try again ;)

Also, maybe (very improbable) it can be the way you are using NOW() within 
the query. Can you show us the query ?


cheers,
--renato

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQL NOW() function producing 0000-00-00 00:00:00

2006-08-25 Thread Renato Golin

Chris Knipe wrote:

Doh.. Wrong email ;)

INSERT INTO a VALUES (NOW()) ?


Sorry, it was not for you, I wanted Jeremiah's query... replied the 
wrong mail... my fault! ;)


--renato

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Re: MySQL NOW() function producing 0000-00-00 00:00:00

2006-08-25 Thread Dan Buettner

Only thing I could guess is that at some point in your code you are executing:

INSERT INTO a VALUES (NOW())

instead, which for me on 5.0.21 results in -00-00 00:00:00

Perhaps you have a function in your code that automatically
quotes/escapes data prior to inserting or updating... that would
likely do it.

Dan


On 8/25/06, Chris Knipe [EMAIL PROTECTED] wrote:

Doh.. Wrong email ;)

INSERT INTO a VALUES (NOW()) ?


Regards,
Chris.

- Original Message -
From: Renato Golin [EMAIL PROTECTED]
To: Chris Knipe [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com
Sent: Friday, August 25, 2006 4:30 PM
Subject: Re: MySQL NOW() function producing -00-00 00:00:00


 Chris Knipe wrote:
 After patiently injecting at about 400 queries per seconds, a couple of
 hours later, I had about 5 million records in a table.  Not a single one
 of them experienced the above

 It's one every 5 million and 1 entries... try again ;)

 Also, maybe (very improbable) it can be the way you are using NOW() within
 the query. Can you show us the query ?

 cheers,
 --renato

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]