I'm connected to a postgresql server as non-privileged user. If I want to rename a column which has length field modifiable then SQL looks like:

ALTER TABLE tablename RENAME columnname  TO newcolumnname;
UPDATE pg_attribute
  SET atttypmod=132
WHERE attrelid=21373::oid AND attnum=6;

even if length value wasn't changed. To successfuly execute that "UPDATE pg_attribute" some privileges are needed to avoid "permission denied for relation pg_attribute" but I don't have because I'm connected as a non-privileged user.

You should store user privileges at connection time and check where is needed if user has enough privileges to do expected operation. In above case to gray out length field. If it's to complicated, at least check if length field was changed and generate "UPDATE pg_attribute" only if needed.

A hint for "permission denied..." would be welcomed.

Regards,
Virgil


---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings

Reply via email to