Tino Wildenhain <tino(at)wildenhain(dot)de> writes:
> I agree with you wholeheartly - it also bothers me why
> postgresql can cast [0-9]+ to int4, but only
> '[0-9]+' to int8 or int2, I really cannot see the
> difference.
> Any ideas where we have to look for the place to patch?
Try reading the thousands of lines of discussion of this problem that
exist in the last several years of the pgsql-hackers archives.
Basically, we have found no solution that doesn't have side-effects
worse than what it fixes. Here's one recent example of a possible
solution that crashed and burned on takeoff:
http://archives.postgresql.org/pgsql-hackers/2002-11/msg00468.php
regards, tom lane