How to Add Check Constraint between Tables (or change DDL)?
One way is to duplicate the max_length column and enforce that they have identical values in the two tables with a composite foreign key (instead of the simple one):

create table if not exists messages(
    id serial
        primary key, 
    max_length smallint not null
        check (max_length &gt; 0),
    default_text text
        check (length(default_text) &lt;= max_length),
    created_on timestamp with time zone not null,
    unique (id, max_length)
);


create table if not exists customized_messages(
    message_id int not null,
    max_length smallint not null,
    message text not null
        check (length(message_text) &lt;= max_length), 
    created_on timestamp with time zone not null,
    foreign key (id, max_length)
        references messages (id, max_length)
);




Note (irrelevant to the question):  the message_id column in the 2nd table does not make sense to be serial and at the same time foreign key to the 1st table.