Fix problems:
1. move the store/restore functions from Connection.java to the
*Command.java
2. modify the PostgresGenerationManagerTest.java to fit the modification
for subquery.