"j.random.programmer" <javadesigner@yahoo.com> writes:
> This is a quick followup to my earlier post. Upon
> further
> testing, this bug reliably and reproducably happens
> when an "alter table" command is used on the database.
So the problem is that it's returning pg_attribute.attnum without any
consideration for earlier dropped columns. Not sure how expensive it'd
be to get the current logical column number, though --- at a minimum one
would have to select all the table's pg_attribute rows :-(
regards, tom lane