pgwire: DEALLOCATE "Name" keeps the quotes in the lookup — a statement prepared by a Parse message as _PLAN0x7 cannot be deallocated (26000); PostgreSQL releases it
#38605
Unanswered
singhpratech
asked this question in
Bug Reports
Replies: 2 comments
|
Thank you so much, @antiguru — that was fast, and the PR goes further than the report: fixing Once #38606 is in an image we can pull, I'll re-run the psqlodbc matrix from postgresql-interfaces/psqlodbc#208 against it (prepared statement freed before and after |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What version of Materialize are you using?
v26.38.1 (e7e46f0),
materialize/materialized:latest, Docker on Linux x86_64.What is the issue?
DEALLOCATE "<name>"does not unquote the identifier: the lookup uses the name with its double quotes. A prepared statement created at the protocol level (aParsemessage, which stores the name exactly as sent) with any uppercase letter in its name therefore cannot be released by SQL —DEALLOCATE "_PLAN0x7"fails with26000 prepared statement "\"_PLAN0x7\"" does not exist, and the unquoted form folds to lowercase and misses too. A lowercase name works either way, and PostgreSQL 16 releases the mixed-case one with the quoted form.(SQL
PREPARE "X" …followed byDEALLOCATE "X"appears to work only because the same quoted string is stored on both sides.)Why it matters: psqlodbc prepares every statement through
Parsewith a name like_PLAN0x63c81a19c220and frees it withDEALLOCATE "_PLAN0x…". On Materialize that always fails; inside a transaction it aborts the transaction, and with the current psqlodbc (see postgresql-interfaces/psqlodbc#208 / #209) a statement freed before the commit loses the transaction's rows silently. The fix on the psqlodbc side is in review (postgresql-interfaces/psqlodbc#209); this is the half that is Materialize's.Steps to reproduce
Expected behavior
DEALLOCATE "_PLAN0x7"releases the statement named_PLAN0x7, as on PostgreSQL: the identifier is unquoted (case preserved) before the lookup, andPREPARE "X"storesXwithout the quotes.All reactions