rails/rails — pull request #12955 by joshwilliams (2013-11-19 21:03:14+00:00)
Title: Postgres schema: Constrain sequence search classid

The pk_an_sequence_for query previously joined against pg_class's oid
for rows in pg_depend, but pg_depend's objid may point to other system
tables, such as pg_attrdef. If a row in one of those other tables
coincidentally has the same oid as an (unrelated) sequence, that
sequence name may be returned instead of the real one.

This ensures that only the pg_depend entries pointing to pg_class are
considered.