sqls $ cat animal.sql DROP TYPE IF EXISTS zoo_t CASCADE; CREATE TYPE zoo_t AS ( wolf_object animal_t, bear_object animal_t
); DROP TYPE IF EXISTS animal_t CASCADE; CREATE TYPE animal_t AS ( animal_id integer, animal_color varchar, animal_name varchar ); CREATE OR REPLACE FUNCTION animal_func() RETURNS void AS $$ DECLARE v_animal animal_t; v_zoo zoo_t; BEGIN v_animal.animal_name:='Chupacabras'; v_zoo.bear_object.animal_name='Mishka'; END; $$ LANGUAGE PLPGSQL; Trying to run it:
sqls $ psql dev < animal.sql DROP TYPE CREATE TYPE NOTICE: drop cascades to 2 other objects DETAIL: drop cascades to composite type zoo_t column wolf_object drop cascades to composite type zoo_t column bear_object DROP TYPE CREATE TYPE ERROR: "v_zoo.bear_object.animal_name" is not a known variable LINE 8: v_zoo.bear_object.animal_name='Mishka'; ^ sqls $
It is not a bug - it is missing feature - left part of assign statement can be variable, array field or record field. Nested structures are not supported now - maybe in future.