Check lock mode in Dataset#lock on PostgreSQL

Currently, the lock mode is used directly in the SQL string, so it
is an avenue for SQL injection.  Checking the input against all
supported PostgreSQL lock modes should fix that.