Skip to content

Commit 0b38ecb

Browse files
committed
Update to enable referencing a schema other than the default schema for the Postgres dialect.
1 parent e8775cf commit 0b38ecb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/Dialects/postgresql.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ exports.escapeId = function () {
99
return exports.escapeVal(el.escapes.shift());
1010
});
1111
}
12-
return "\"" + el.replace(/\"/g, "\"\"") + "\"";
12+
return el.split(".").map(function (ele) { return "\"" + ele.replace(/\"/g, "\"\"") + "\""; }).join(".");
1313
}).join(".");
1414
};
1515

test/integration/test-dialect-postgresql.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ assert.equal(
1717
'"table"."co""l"'
1818
);
1919

20+
assert.equal(
21+
dialect.escapeId('schema.table', 'col'),
22+
'"schema"."table"."col"'
23+
);
24+
2025
assert.equal(
2126
dialect.escapeVal(undefined),
2227
'NULL'

0 commit comments

Comments
 (0)