"Day, David" <david(dot)day(at)redcom(dot)com> writes:
> The error is something like column already exists and
Not sure about the workflow this function is used within, but maybe you
need to consider what to do when both the old and new column names exist.
Because that sure sounds like what is happening.
regards, tom lane