Hi Marcos,

> In a multi tenant world this feature will be cool for clone or sync ddl of
> two schemas. So, if I’m creating a new schema the way you did works but if
> both exists and I want to update some ddls of a schema, sometimes I have to
> DROP and CREATE or returned command should have CREATE OR REPLACE,
> depending on what ddl you are doing.
>
If you try to create a trigger but it already exists, you’ll get an
> exception, so you can emit a DROP IF EXISTS before CREATE of that trigger.
> For this that param drop_first would be.
> I know you are doing only trigger ddl rigth now but I think we would have
> this kind of functions for tables, constraints, triggers, domains and so
> on, then all of them should work the same way, and for this a drop_first or
> if_exists would be good.
>

Thanks for the feedback.

That makes sense, and you're right, for the 'multi-tenant sync' use case
you're describing, just having the CREATE statement will cause an 'object
exists' error. The way I've scoped this particular function is more
general. That drop_first feature is great for a sync script, but the core
idea here is just to retrieve the DDL text. It's up to the developer using
it to decide how to implement it (like adding a DROP first).

-- 
Best,
Phil Alger

Reply via email to