Tim Pizey <[EMAIL PROTECTED]> writes: > If there is a a record with a Null textid in the table then psql reports > the error: > Invalid (null) int8, can't convert to float8 > to a query of the form > select id from chapter where textid = 9057599501; > It does seem as though the textid in the query needs to be large to > produce the error. This is actually being interpreted as select id from chapter where textid = 9057599501::float8; and then the parser decides it needs to convert textid to float8 and perform a float8 '=' (which among other things means this query won't use the index). This happens because the parser is going to interpret that undecorated numeric constant as either int4 or float8, and it's too big for int4, so float8 gets picked. We have had some discussions about teaching the parser to be smarter about choosing the type of numeric constants depending on context, but for now you need to force the issue: select id from chapter where textid = 9057599501::int8; If you want the index to be used then you'd better do this all the time, not only for values that are too big to be int4. BTW, the inability to convert an int8 NULL to float8 is a bug; it's fixed in 7.1. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl