Hi, we have a PHP project on Phalcon MVC. We recently migrated from SQL to Aurora DSQL. I created the relevant adapter file extending Postgres Adaptor from PDO.
All transactions work just fine but as soon as I wrap any transaction in BEGIN/COMMIT it fails. There is no error/exception whatsoever but there is no data in the DB. If I attempt raw psql queries wrapped in BEGIN/COMMIT they also work just fine. So something in Phalcon adapter is silently crashing.
I have made sure that begin, commit and transaction happen on the same connection. Auto-commit is off.
Has anyone else faced this issue working with PHP and Aurora DSQL? Could it just be a Phalcon ORM issue?
I have created some Rust Lambdas speaking to Aurora DSQL and I am using the Rust connector to start and commit transactions. Is there a PHP connector for your library for that as well?
Moderators, please consider using your LLM to parse the OP’s post to decide if it’s sufficiently detailed that a generic “Here are a few handy links” response would be unhelpful and effectively spamming the channel. Thanks.
TL;DR: There’s a bug in pdo_pgsql’s prep stmt handling. Fix is: PDO::ATTR_EMULATE_PREPARES => true.
I spent a little time reproing the issue and getting a wire capture from PHP → DSQL. Here’s what’s happening on the failing BEGIN/INSERT/COMMIT:
F Query “BEGIN” → OK, tx open
F Parse/Bind/Execute “INSERT …” → OK, row accepted
F Query “DEALLOCATE pdo_stmt_1” ← pdo_pgsql auto-cleanup
B ERROR 0A000 “DEALLOCATE not supported”
B ReadyForQuery ‘E’ – tx is now poisoned
F Query “COMMIT”
B CommandComplete “ROLLBACK” – PG semantics: commit on failed tx = rollback
A few things conspire:
PHP’s pdo_pgsql sends DEALLOCATE <name> after every prepared statement.
DSQL doesn’t implement DEALLOCATE <name> yet, so this returns an error to the client.
Error-inside-tx → tx aborted → next COMMIT silently returns ROLLBACK.
PHP never sees an exception because the DEALLOCATE wasn’t in your code — it’s in pdo_pgsql’s destructor. Your INSERT returned success, your COMMIT returned a CommandComplete, but your row is gone because of the rollback. pdo_pgsql calls deallocate unconditionally and ignores the response, so it’s not showing that the transaction has entered an error.
Phalcon’s query() goes through extended-prepare so it triggers this; execute() uses simple-query so it doesn’t.
Emulated prepares bypass libpq’s extended protocol entirely → no DEALLOCATE → no silent rollback. I verified that by adding that transactions succeed.
Also another tip, if you use Phalcon’s Transaction Manager: it defaults to SAVEPOINT-based nested transactions and DSQL doesn’t support SAVEPOINT either. Add $db->setNestedTransactionsWithSavepoints(false).
Sorry the bot is from 1994. Best we can do is a keyword match. I see you’re talking about Aurora, heres links to all our documentation on every database and some other database-like stuff.
It worked!! I spent 2 weeks struggling with it before finally posting on Reddit. I wanna know 2 things
Your BuyMeACoffee link. For some reason Reddit crashes when I try to buy an award on my phone and I really want to get you a nice cup of coffee as thank you.
How did you debug this? I literally threw everything at it, with logs after every single line of code but couldn’t get to this.
I actually work on DSQL so I’m pretty familiar with which parts of the Postgres syntax we don’t support yet. I was able to get a repro going from your description with some agentic help, and from there I used PQtrace to get a capture of the client/server packets being sent. That was what I needed to see the above.
The Postgres extended query protocol can get a little funky across all of the implementations, and DEALLOCATE typically never fails so some clients ignore the response. DEALLOCATE syntax support is on the roadmap and will be coming to DSQL in the future!