Allow SQL commands to be run against a specific DB

If resource[:db] is set, then it is sent to psql. 

Otherwise, argument is omitted and should not introduce any regression.