From: andrei dot vig at ecommerce dot com
Operating system: Debian GNU
PHP version: 5.2CVS-2007-12-21 (snap)
PHP Bug Type: PDO related
Bug description: Strange error message when performing a query
Description:
------------
i am trying to run a few lines of code and i am getting the following
error. Can you please give me a hint here :
Error message :
Invalid datetime format: 7 ERROR: invalid input syntax for type timestamp:
"2007-12-21 07$1$2"' and error code 22007
Reproduce code:
---------------
Code :
$s_sql = "SELECT hd.hd_ticketid,
hdc.title AS category_title,
hds.title AS status_title,
hd.subject,
hd.datetimecreated,
extract(epoch from hd.datetimecreated) as
datetimecreated_timestamp,
CASE
WHEN hd.domain IS NOT NULL THEN hd.domain
WHEN hd.dom_domain IS NOT NULL THEN hd.dom_domain
ELSE 'General Inquiry'
END as target,
CASE
WHEN loginid_last_repl <> 56455 AND
(hd.hd_statusid = 3 OR hd.hd_statusid = 1) THEN 'Processing Ticket'
WHEN hd.hd_statusid = 2 THEN '<a
href=''http://andrei-ixhead.ecommerce.com/index.php/cpanelhelpdesk.getFrmTicketModify/hd_ticketid/'
|| hd.hd_ticketid ||'''>Please Respond</a>'
WHEN hd.hd_statusid = 4 THEN '<a
href=''http://andrei-ixhead.ecommerce.com/index.php/cpanelhelpdesk.getFrmTicketModify/hd_ticketid/'
|| hd.hd_ticketid ||'''>Review Solution</a>'
WHEN hd.hd_statusid = 5 THEN 'Ticket Closed'
WHEN loginid_last_repl = 56455 THEN (extract(epoch
from '2007-12-21 07:42:53'::timestamp) - extract(epoch from
coalesce(hd.datetimemodified_customer, hd.datetimecreated)))::varchar
END as time_passed,
CASE
WHEN loginid_last_repl <> 56455 AND
(hd.hd_statusid = 3 OR hd.hd_statusid = 1) THEN -4
WHEN hd.hd_statusid = 2 THEN -3
WHEN hd.hd_statusid = 4 THEN -2
WHEN hd.hd_statusid = 5 THEN -1
WHEN loginid_last_repl = 56455 THEN extract(epoch
from '2007-12-21 07:42:53'::timestamp) - extract(epoch from
coalesce(hd.datetimemodified_customer, hd.datetimecreated))
END as time_passed_timestamp,
customer_read,
CASE
WHEN datetimeconfirmed IS NULL THEN '<a
href=''http://andrei-ixhead.ecommerce.com/index.php/cpanelhelpdesk.qryTicketVerify/hd_ticketid/'
|| hd.hd_ticketid ||'''>Verify</a>'
ELSE 'Verified'
END as verify_link,
CASE
WHEN hd.hd_statusid = 5 THEN 'Closed'
ELSE 'Close'
END AS close_link,
CASE WHEN 4=hd.hd_statusid THEN hd.hd_ticketid ELSE
NULL END AS close_ticketid
FROM hd_ticket hd
INNER JOIN hd_ticket_category hdc
USING(hd_ticket_categoryid)
INNER JOIN hd_ticket_status hds USING(hd_statusid)
WHERE hd.customerid = 56204 AND hd.b_visible AND
hd.hd_statusid IN (1,2,3,4)GROUP BY hd.hd_ticketid,
hdc.title,
hds.title,
hd.subject,
hd.datetimecreated,
hd.domain,
hd.dom_domain,
hd.customer_read,
hd.hd_statusid,
hd.datetimemodified_emp,
hd.datetimemodified_customer,
hd.loginid_last_repl,
hd.datetimeconfirmed ORDER BY hd.hd_statusid = 2,
hd.hd_statusid = 4, hd.hd_ticketid DESC LIMIT 1 OFFSET 0";
$o_pdo->query($s_sql);
Expected result:
----------------
query works when i run it directly in psql
--
Edit bug report at http://bugs.php.net/?id=43649&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43649&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43649&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43649&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43649&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43649&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43649&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43649&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43649&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43649&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43649&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43649&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43649&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43649&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43649&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43649&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43649&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43649&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43649&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43649&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43649&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43649&r=mysqlcfg