Hi Alan
Okay. first question is which update is this coming from? It might be listed in your log file but, a quick search for pg_attribute in the 0_8_2 database updates folder quickly shows it is 201303071000_term_field_size.sql. (We have cross-posted, I see.)
The update is very small
-- Hacky but efficient way to increase terms.term field size across all dependencies
update pg_attribute set atttypmod=204 where attname='term' and atttypmod=104 and atttypid=1043
which I can translate, thanks to the docs, as "change the length of any varchar field called 'term' to 200 characters in any table or view where it is currently 100 characters."
This update was presumably just added to your system so this is the first attempt to run it. It is an odd one as it is modifying the postgreSQL catalogue rather than the tables directly. I haven't seen this before. As the comment in the update says, "Hacky".
The fact that you are getting permission denied for trying to mess with the tables that postgres uses to organise itself is not all that surprising. More surprising is that my system has logged running the update successfully. If I look at the pg_attribute table (which is in the PostgrSQL catalog in the Indicia database) the update appears to have been ineffective, however.
I can suggest a workaround (running the query in pgAdmin as superuser and then updating the last_run_script to pretend it executed correctly) or you could just delete the update file and live with the current limit on the size of terms.
I guess the friendly
ALTER TABLE terms ALTER term TYPE character varying(200);
was rejected because, as the PostgreSQL documentation says
If a table has any descendant tables, it is not permitted to add, rename, or change the type of a column in the parent table without doing the same to the descendants. That is, ALTER TABLE ONLY will be rejected. This ensures that the descendants always have columns matching the parent.
so it may just be a way to avoid updating the views that use it.
I'm not sure it is a good hack either because
select pgc.relname, pga.attname, pga.atttypid, pga.atttypmod from pg_attribute pga
join pg_class pgc on pgc.oid = pga.attrelid
where pga.attname = 'term'
suggests it affects things that are not related to 'terms.term'.
Also the query is trying to update from 100 to 200 characters in size and my system currently has a size of 150 so that wouldn't have worked anyway.
Perhaps John can tell us if there is any reason why we shouldn't do it the long way which would be to drop all the views, update the column and recreate all the views.
Sorry, Alan. I think this one is a problem on our side.
Jim Bacon.