You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That doesn't work, iirc, because each of those is a new connection. You'd need to put your queries in a file and then pass the file to psql using the command module, I think.
This is not ideal because one can only access the result of the last statement, and every iteration of an ansible loop will be a dedicated transaction.
The community.postgresql.postgresql_script module works the same way, but there the statements are read from a file on the target host instead from a variable.
To have a single transaction across multiple ansible tasks as you requested is currently not supported. Maybe it could work if we extend the module(s) to receive and return a variable holding an open transaction, but I'm not sure if this is possible with ansible.
SUMMARY
Ability to begin/commit/rollback a transaction. This can help to group certain queries together so they all take effect at once.
ISSUE TYPE
COMPONENT NAME
community.postgresql.postgresql_query
ADDITIONAL INFORMATION
Some queries belong together and they either must all succeed or all fail. The approach below doesn't seem to work.
The text was updated successfully, but these errors were encountered: