postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: siga0984 (@siga0984) <[email protected]>
To: postgresql-interfaces/psqlodbc <[email protected]>
Subject: [postgresql-interfaces/psqlodbc] issue #102: Statement using WITH and INSERT does not work when UseDeclareFetch=1
Date: Mon, 07 Apr 2025 20:06:29 +0000
Message-ID: <[email protected]> (raw)

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


view thread (11+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://postgresql-interfaces/psqlodbc
  Cc: [email protected], [email protected]
  Subject: Re: [postgresql-interfaces/psqlodbc] issue #102: Statement using WITH and INSERT does not work when UseDeclareFetch=1
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox