pg-promise不理解UTF密码?我无法使用它们。尝试使用linux和osx,postgres 9.3,9.5 - 似乎并不是特定于版本。看着代码。 pg-promise使用pg,它使用基于后pg-connect-string构建的pg。找不到问题的根源。请帮忙。
MacBook-Air:js vao$ cat 2.js
var pgp = require("pg-promise")(); var cs = 'postgresql://utf:утф@127.0.0.1:5433/a'; var db = pgp(cs); db.connect() .then(function (obj) { obj.done(); // success, release the connection; }) .catch(function (error) { console.log("ERROR:", error.message || error); }); console.log(cs);
MacBook-Air:js vao$ node 2.js
postgresql://utf:утф@127.0.0.1:5433/a ERROR: password authentication failed for user "utf"
psql
相同的连接字符串:MacBook-Air:js vao$ psql 'postgresql://utf:утф@127.0.0.1:5433/a'
psql (9.5.3) Type "help" for help. a=> \q
MacBook-Air:js vao$ psql 'postgresql://utf:утфWrongPassword@127.0.0.1:5433/a'
psql: FATAL: password authentication failed for user "utf" MacBook-Air:js vao$