Changing the dependency isn't enough. You also want to bump the version number (say, A.B.C.D into A.B.C.D.1) and make your project depend on the bumped version. This way cabal wont find that version anywhere but in installed database and will continue just fine.
If the library works fine under base-4 you might also contact the developer so that he can upload the new version which will allow you to drop that hack altogether.
Working with such locally-changed versions can be easier if you try cabal-devel tool or similar.
But I think might consider another solution: don't use that library. As HDBC docs says:
So clearly, HDBC developer(s?) think that HDBC-odbc is the way.
Best regards,
Krzysztof Skrzętnicki