Caveats with EXECUTE STATEMENT
-
There is no way to validate the syntax of the enclosed statement
-
There are no dependency checks to discover whether tables or columns have been dropped
-
Execution is considerably slower than when the same statements are executed directly as PSQL code
-
Return values are strictly checked for data type to avoid unpredictable type-casting exceptions.For example, the string
'1234'
would convert to an integer, 1234, but'abc'
would give a conversion error
All in all, this feature is meant to be used cautiously, and you should always take the caveats into account.If you can achieve the same result with PSQL and/or DSQL, it will almost always be preferable.