Andres Freund <andres@anarazel.de> writes:
> I have two questions now:
> First, does anybody think it would be worth getting rid of the duplication
> from OpenIntoRel (formerly from execMain.c) in regard to DefineRelation()?
That's probably reasonable to do, since as you say it would remove the
opportunity for bugs-of-omission in the CTAS table creation step.
OTOH, if you find yourself having to make any significant changes to
DefineRelation, then maybe not.
> Secondly, I am currently wondering whether it would be a good idea to use the
> ModifyTable infrastructure for doing the insertion instead an own DestReceiver
> infrastructure thats only used for CTAS.
I think this is probably a bad idea; it will complicate matters and buy
little. There's not a lot of stuff needed for the actual data insertion
step, since we know the table can't have any defaults, constraints,
triggers, etc as yet.
regards, tom lane