dtoi4 error

From: "Philip Molter" <user(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: dtoi4 error
Date: 2001-04-11 20:59:12
Message-ID: AA3B6.135058$QC3.8157622@news3.aus1.giganews.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm working on porting an application from MySQL to PostgreSQL. We have one
query which is rather monstrous. When I run this query, I'm getting an
error 'dtoi4: integer out of range'. I'm not sure what's causing it, and
I'm not sure how to fix it. Since Postgres isn't giving me a very detailed
error message, I'm sort of at a loss of where to search to find where the
conversion is failing.

The MySQL functions listed have counterparts written in Postgres (Zachary
Beane's available functions).

Here's the query:

SELECT h.id, h.name, h.info, h.comm, h.gid, h.active,
h.low, h.sys, h.rev,
UNIX_TIMESTAMP( p.next ) AS next, p.id, p.did as dwid,
pt.units, pt.interval, pt.table, pt.name,
pt.type, IFNULL( sl.state, 0 ) AS state, sl.value,
UNIX_TIMESTAMP( sl.start_time ) AS sctstamp,
sl.state AS log_state,
SUM( IFNULL( sd.state, 0 ) >> 1 ) AS dephold,
IFNULL( pth.d1_time, ptt.d1_time ) AS d1_time,
IFNULL( pth.d1_min, ptt.d1_min ) AS d1_min,
IFNULL( pth.d1_max, ptt.d1_max ) AS d1_max,
IFNULL( pth.d2_time, ptt.d2_time ) AS d2_time,
IFNULL( pth.d2_min, ptt.d2_min ) AS d2_min,
IFNULL( pth.d2_max, ptt.d2_max ) AS d2_max,
r.running, plf.field, plf.min, plf.max,
wft.maptype AS field_type
FROM percept p
INNER JOIN h1 h ON h.id=p.id
INNER JOIN pt1 pt ON pt.ptid=p.ptid
LEFT JOIN pth1 pth ON pth.id=p.id
LEFT JOIN sl1 sl ON sl.id=p.id AND sl.dur IS NULL
LEFT JOIN pdc1 pdc ON pdc.id=p.id
LEFT JOIN sl1 sd ON pdc.did=sd.id AND
sd.duration IS NULL
LEFT JOIN run r ON p.id=r.id
LEFT JOIN plf1 plf ON p.id=plf.id
LEFT JOIN ptt1 ptt ON p.ptid=ptt.ptid
LEFT JOIN wft1 wft ON plf.t=wft.fieldtype AND
pt.type=wft.type
WHERE p.deleted = 0 AND
p.next <= NOW() AND
pt.interval IS NOT NULL AND
r.running IS NULL
GROUP BY h.id, h.name, h.info, h.comm, h.gid,
h.active, h.low, h.sys, h.rev,
p.next, p.id, pt.units, pt.interval, pt.table,
pt.name, sl.state, sl.value, sl.start_time,
r.running, plf.field, plf.min, plf.max,
pt.type, p.did, wft.maptype,
IFNULL( pth.d1_time, ptt.d1_time ),
IFNULL( pth.d1_min, ptt.d1_min ),
IFNULL( pth.d1_max, ptt.d1_max ),
IFNULL( pth.d2_time, ptt.d2_time ),
IFNULL( pth.d2_min, ptt.d2_min ),
IFNULL( pth.d2_max, ptt.d2_max )
HAVING SUM( IFNULL( sd.state, 0 ) >> 1 ) = 0

If I change the where to be 'WHERE p.id=5' (or any other member integer),
the query succeeds with no problems. Table names and fields have been
changed, but that shouldn't make a difference.

Any ideas?
Thanks in advance for any assistance,
Philip

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Philip Molter 2001-04-11 21:43:36 Re: dtoi4 error
Previous Message Flemming Frøkjær 2001-04-11 20:41:29 Re: PHP question