             return @updateOne(values, cb)
 
         keyProperties = mergeKey.properties()
-        q = sql.upsert(@sqlAlias(), values, keyProperties)
+        q = sql.upsert(@sqlAlias, values, keyProperties)
         return @doOutputQuery(q, cb)
 
     doOutputQuery: (q, cb) ->

class TableGateway
    constructor: (@db, @schema, @arProto) ->

    sqlAlias: () -> @schema.many
    toString: () -> "<TableGateway to #{@sqlAlias()}>"

    newObject: (data) ->
        ar = Object.create(@arProto)

    deleteOne: () -> @doOne(@_delete, arguments, 'delete')

    _delete: (predicate, cb) ->
        s = sql.delete(@sqlAlias, predicate)
        return @db.bindOrCall(s, 'noData', cb)

    doOne: (fn, args, opName, queryArgument) ->
