运行以下代码:
$preCallMatch = pg_prepare($dbcp, 'callMatch',
"SELECT duration
FROM voip_calls
WHERE system_id = $1
AND call_start => $2
AND call_start <= $3
AND destination = $4");
我收到以下错误:
Warning: pg_prepare(): Query failed: ERROR: operator does not exist: timestamp without time zone => "unknown"
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. in /home/www/dinesh/UPSReconcileZeroSecondCalls.php on line 38
我尝试以这种方式投出$ 2而没有运气:
$preCallMatch = pg_prepare($dbcp, 'callMatch',
"SELECT duration
FROM voip_calls
WHERE system_id = $1
AND call_start => CAST ( $2 AS TIMESTAMP )
AND call_start <= CAST ( $3 AS TIMESTAMP )
AND destination = $4");
Warning: pg_prepare(): Query failed: ERROR: operator does not exist: timestamp without time zone => timestamp without time zone
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. in /home/www/dinesh/UPSReconcileZeroSecondCalls.php on line 38
来自voip_calls表的列类型:
call_start | timestamp without time zone |
call_end | timestamp without time zone | not null
关于我做错了什么的提示?注意,PDO或MDPD现在不是一个选项。
软件版本:
ii php5 5.2.6.dfsg.1-1+lenny3 server-side, HTML-embedded scripting languag
ii libapache2-mod-php5 5.2.6.dfsg.1-1+lenny3 server-side, HTML-embedded scripting languag
ii php5-pgsql 5.2.6.dfsg.1-1+lenny3 PostgreSQL module for php5
ii libpq5 8.3.8-0lenny1 PostgreSQL C client library
postmaster (PostgreSQL) 8.1.4
答案 0 :(得分:0)
可能是你的=&gt;导致问题的运算符 - 尝试&gt; =而不是。
另外作为提示,我发现编写$ 2 :: timestamp而不是CAST($ 2 AS TIMESTAMP)更容易 - 它是PostgreSQL特定的语法,但对我来说读得更好(而且输入的次数更少;-))
答案 1 :(得分:0)
原来是&lt; =和=&gt;运营商。这样做很好:
$preCallMatch = pg_prepare($dbcp, 'callMatch',
"SELECT duration
FROM voip_calls
WHERE system_id = $1
AND call_start BETWEEN $2 AND $3
AND destination = $4");