php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43649 Strange error message when performing a query
Submitted: 2007-12-21 07:47 UTC Modified: 2008-01-07 01:00 UTC
From: andrei dot vig at ecommerce dot com Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.2CVS-2007-12-21 (snap) OS: Debian GNU
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: andrei dot vig at ecommerce dot com
New email:
PHP Version: OS:

 

 [2007-12-21 07:47 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-30 16:34 UTC] iliaa@php.net
Can you try executing the following query and see if it works:

"SELECT extract(epoch from '2007-12-21 07:42:53'::timestamp)"

 [2008-01-07 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 10:01:30 2024 UTC