---    Rozšírenie stlpca DRUH v tabuľke UEXARCHOBRATY

----    slovenskaverzi XX a=.T.       ----
DO
$$
BEGIN
IF EXISTS (SELECT table_name FROM information_schema.tables WHERE table_schema='food600' and table_name='uexarchobraty') THEN
	IF  EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='food600' and table_name='uexarchobraty' and column_name='druh' and character_maximum_length=20) THEN
		ALTER TABLE food600.uexarchobraty ALTER COLUMN druh TYPE character(40) COLLATE pg_catalog."default";
	END IF;
END IF;

IF EXISTS (SELECT table_name FROM information_schema.tables WHERE table_schema='food600' and table_name='uexarchpolozky') THEN
	IF  EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='food600' and table_name='uexarchpolozky' and column_name='druh' and character_maximum_length=20) THEN
		ALTER TABLE food600.uexarchpolozky ALTER COLUMN druh TYPE character(40) COLLATE pg_catalog."default";
	END IF;
END IF;

IF EXISTS (SELECT table_name FROM information_schema.tables WHERE table_schema='food600' and table_name='u_ex_pol') THEN
	IF  EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='food600' and table_name='u_ex_pol' and column_name='druh' and character_maximum_length=10) THEN
		ALTER TABLE food600.u_ex_pol ALTER COLUMN druh TYPE character(40) COLLATE pg_catalog."default";
	END IF;
END IF;

IF EXISTS (SELECT table_name FROM information_schema.tables WHERE table_schema='food600' and table_name='u_ex_obr') THEN
	IF  EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='food600' and table_name='u_ex_obr' and column_name='druh' and character_maximum_length=20) THEN
		ALTER TABLE food600.u_ex_obr ALTER COLUMN druh TYPE character(40) COLLATE pg_catalog."default";
	END IF;
END IF;

END
$$
