ID: 43649
Updated by: [EMAIL PROTECTED]
Reported By: andrei dot vig at ecommerce dot com
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: Debian GNU
PHP Version: 5.2CVS-2007-12-21 (snap)
New Comment:
Can you try executing the following query and see if it works:
"SELECT extract(epoch from '2007-12-21 07:42:53'::timestamp)"
Previous Comments:
------------------------------------------------------------------------
[2007-12-21 07:47:29] andrei dot vig at ecommerce dot com
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 this bug report at http://bugs.php.net/?id=43649&edit=1