Random postings about IBM Informix

Spending most of my day, as I do, working for the beast (Oracle), it’s not so often I get chance to do any decent Informix work, let alone a bit of coding. So today I spotted an opportunity to brush up on my SPL skills after coming across this error:

892: Cannot disable object (informix.mytableuk01) due to other active objects using it.

As the system was in single user mode at the time because I was doing some maintenance work, this seemed rather puzzling.

The offending code was:

begin;
set contraints for mytable disabled;

This command should have disabled all constraints on table mytable and also any referencing constraints. For some reason this did not work.

I began by looking at the output from dbschema and worked my way through but pretty soon I realised that there were an awful lot of dependencies on this table.

So I came up with this function which finds them in no time and may prove useful for someone else:

And there we have it! A function that will show all the dependencies and on which tables you need to disable constraints. It can cope with circular dependencies – that is what the temporary table is used for.