خرید بک لینک

Vote count: 0

I'd like to INSERT the current timestamp with CURRENT_TIMESTAMPon each new user registration. The column number equal the number of parameters in VALUES. Yet I get INSERT has more target columns than expressions. Using the node-postgres npm module as a controller.

                         //Just 3 parameters, timestamp is hardcoded in the query
exports.create = function (useame, email, password) {
    DB.coect(coection, function (err, client, done) {
        var query = client.query(

    //4 columns 
    "INSERT INTO users (useame, email, userpass, datecreated) VALUES" +
    //4 parameters
    "(" + "'" + useame + "'" + "," + "'" + email + "'" + "," + "'" + password + "'" + "'CURRENT_TIMESTAMP')");
        query.on('error', function (error) {
            console.log("query retued an " + error);
        });
        query.on('row', function (row, result) {
            result.addRow(row);
        });
    });
};

asked 4 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 18 خرداد 1395 ساعت: 20:10

صفحه بندی