I have my
wp-cli.yml configured with a working ssh connection.
wp db query "CHECK TABLE $(wp db tables | paste -s -d, -);" and run locally it works just fine.
On the other hand, if I
wp @prod db query "CHECK TABLE $(wp db tables | paste -s -d, -);"
I get "too many positional arguments"
wp @prod option get home - it works fine.
This leads me to conclude that the escaping of the remote command is causing the error - no amount of testing has revealed the "right" combination of single/double-quotes to get the command to the remote server.