SQL:
CREATE TABLE second_type (
flag BOOLEAN
);
CREATE TABLE main_type (
subtype second_type
);
CREATE OR REPLACE FUNCTION "bug_in_tabletypes" () RETURNS pg_catalog.void AS
$body$
DECLARE
row_main_table main_type%rowtype;
BEGIN
row_main_table.subtype := NULL; -- all okey;
row_main_table.subtype.flag := FALSE; -- cannot set
END;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
Will produce error:
ERROR: syntax error at or near "row_main_table"
LINE 1: row_main_table.subtype.flag := FALSE
^
QUERY: row_main_table.subtype.flag := FALSE
CONTEXT: SQL statement in PL/PgSQL function "bug_in_tabletypes" near line