laravel-pdo-odbc icon indicating copy to clipboard operation
laravel-pdo-odbc copied to clipboard

Snowflake: Query executed twice with queries like: alter statements

Open yoramdelangen opened this issue 2 years ago • 1 comments

Ours and Snowflake's documentation states that prepare queries are executed directly on sent to the server. This is the default behavior of Snowflake, it can be disabled by adding to the driver configuration (Mac/Linux users: simba.snowflake.conf): NoExecuteInSqlPrepare=true.

But recently we have experienced this configuration is not working and were currently working with Snowflake support/internal ODBC dev team to look into this problem.

~~We have found 2 workarounds for this:~~ ~~1. Remove or set NoExecuteInSqlPrepare=false and make sure you are using version 1.1.4. Because it is not executing the PDO original execute method on the PDO class when detecting 0 values bound to the prepare method.~~ ~~2. Start using the snowflake_pdo extension which is supported from version 1.2.~~

UPDATE 2022-05-25

We have narrowed it down to alter column add constraint queries to fail and not respecting the NoExecuteInSqlPrepare=true driver configuration. Current workaround is within version 1.1.5, we're checking if the query is containing "add constraint" on execute. If so, we skip calling the execute call.

Support for the PDO snowflake PHP extension is available in 1.1.5.

yoramdelangen avatar May 23 '22 16:05 yoramdelangen