Message-ID: From: "siga0984 (@siga0984)" To: "postgresql-interfaces/psqlodbc" Date: Mon, 07 Apr 2025 20:06:29 +0000 Subject: [postgresql-interfaces/psqlodbc] issue #102: Statement using WITH and INSERT does not work when UseDeclareFetch=1 List-Id: X-GitHub-Author-Id: 11068123 X-GitHub-Author-Login: siga0984 X-GitHub-Issue: 102 X-GitHub-Repo: postgresql-interfaces/psqlodbc X-GitHub-State: closed X-GitHub-Type: issue X-GitHub-Url: https://github.com/postgresql-interfaces/psqlodbc/issues/102 Content-Type: text/plain; charset=utf-8 The below example works fine, since I don't set UseDeclareFetch=1 in Odbc.ini First, create the necessary tables. `CREATE TABLE ORIGEM(CAMPO char(4) )` `CREATE TABLE DESTINO(CAMPO char(4) )` `INSERT INTO ORIGEM(CAMPO) values ('0001')` Then, using (Windows or Linux) ODBC thought any odbc client program ( even UnixODBC ISQL) , execute the following statement: `WITH TRB(CAMPO) AS ( SELECT CAMPO FROM ORIGEM ) INSERT INTO DESTINO(CAMPO) SELECT CAMPO FROM TRB` If ODBC.INI configuration UseDeclareFetch is zero, it works fine, as expected. But, if `UseDeclareFetch=1`, the result is : `DIAG [42601] ERRO: erro de sintaxe em ou próximo a "INSERT";` `Error while executing the query (1) ` This example is a reduced form, the smallest query I've test and got the issue. Tested with previous ODBC previous versions also fails, even the last one (17.00.0004). Let me know if I can help somehow. Best regards, Julio Wittwer