[1.7.2] Fixed #24051 -- Backported code from master to 1.7.2.

Prevent table from being created in default schema when the
schema is specified in the model or in the settings.

For ticket #24051