我目前使用node-postgres查詢我的數據庫,像這樣: SELECT DISTINCT(name) FROM users.names ORDER BY name;
我要回這些名字的小寫,所以我嘗試這樣做: SELECT DISTINCT(lower(name)) FROM users.names ORDER BY lower(name);
...但這只是返回null來代替每個名稱。
我試圖圍繞藍鳥承諾包裹我的頭,並通過文檔中的一些示例。我當前的代碼是基於this example:不出所料 var Promise = require('bluebird');
var pg = Promise.promisifyAll(require('pg'));
var using = Promise.using;
function getConnection(string) {
這個錯誤似乎是常見的Windows盒,但我的Linux亞馬遜EC2實例拋出這個錯誤,當我npm install pg: ../src/binding.cc:1:23: fatal error: pg_config.h: No such file or directory
#include <pg_config.h>
^
compilation terminated.
make
有什麼特別的我需要做一個參數化查詢? 以下似乎成功(我用一個承諾 - 指明分數client.query見底), console.log('cancel for', data);
var cancelInviteQuery = 'delete from friendship where user_1=$1 and user_2_canonical=$2';
return query(cancel