New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add section for PREPARE #43
Comments
@sumedhpathak does 5.2 fix this issue? |
We support params in prepared statements now, but I'm not sure whether the issues was fixed of doing >6 inserts in a prepared statement. @sumedhpathak do you know? |
@begriffs -- We track our support for In particular, this comment has a table that captures our We're also planning to offer a workaround in v6.1 that mitigates issues related to PREPARE: citusdata/citus#904 |
Nowadays perhaps the only restrictions on PREPARE are for sql functions? At least it looks that way from citusdata/citus#1179 Is this enough of a problem that we need documentation around it? |
We support prepare now. |
PREPARE
support is one of the most frequent questions we hear from users; and I just wanted to copy/paste an example email thread from our users list here.Hi,
I observe some odd bug when I use JDBC driver to INSERT rows to hash-distributed table. Basically, you cannot do more than 10 INSERTs in one JDBC connection.
This can be easily reproduced with Docker image 5.1.0.
Steps to reproduce:
Every time I run this code, I get SQLException on 10th INSERT to hash-distributed table:
This seems to be a bug, although I don't understand what causes it. Any ideas?
Artem
Hi,
Thanks for reaching us.
Citus currently does not support prepared statements with parameters. And, JDBC connection, by default uses prepared statements internally. We are already tracking the issues in our github repo (#306, #572) and prioritized #572 for the next release.
There is also a related discussion in this users group, which considers one of the workarounds: https://groups.google.com/forum/#!topic/citus-users/3weujcKEf38
I can think of another workaround by disabling the use of prepared statements on the JDBC. As far as I remember, you can do that by setting the JDBC protocol version to 2 in the database connection URL such as: dbc:postgresql://127.0.0.1:5432/username?protocolVersion=2
Hope this helps,
Onder
Thank you, this was very helpful hint.
I found out that it is enough to disable prepared statements in JDBC driver.
This can be done by either calling dataSource.setPrepareThreshold(0), or by adding ?prepareThreshold=0 to connection string.
In either case, I am able to use PreparedStatement API to set query parameters (which is much safer than building SQL string by hand), and yet keep my INSERTs working.
I will continue my exepriments and probably come back soon. Thank you.
The text was updated successfully, but these errors were encountered: