Thanks a lot for your answer. I had the same issue when running an old version of ruby on rails with a newer postgres database. I substituted d.adsrc with pg_get_expr(d.adbin, d.adrelid) in de ruby postgres adapter and the problem went away.