Richard Huxton <[EMAIL PROTECTED]> writes: > Since your error seems to be complaining about a space, I'd guess you've got > other than numeric values in _aaa.
In fact, with a bit of experimentation I see the same error message: regression=# select to_number('12345', '99999'); to_number ----------- 12345 (1 row) regression=# select to_number('1234 ', '99999'); to_number ----------- 1234 (1 row) regression=# select to_number(' 1234', '99999'); to_number ----------- 1234 (1 row) regression=# select to_number(' ', '99999'); ERROR: invalid input syntax for type numeric: " " regression=# select to_number('zzzzz', '99999'); ERROR: invalid input syntax for type numeric: " " regression=# The error message's report of the input string seems a tad misleading, especially in the last case. (Karel, is this fixable?) But anyway, it sure looks like the problem is bad input data. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match