Skip to content

Commit

Permalink
fix(_getKV): error: type "string" does not exist due to ::STRING cast
Browse files Browse the repository at this point in the history
fixes #83

Signed-off-by: Tobias Gurtzick <[email protected]>
  • Loading branch information
wzrdtales committed Sep 12, 2023
1 parent 1a8e7a4 commit ec66452
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ var PgDriver = Base.extend({
var sql =
`SELECT ${this.escapeDDL('key')},
${this.escapeDDL('value')},
${this.escapeDDL('run_on')}::STRING
${this.escapeDDL('run_on')}::${this.mapDataType(this.type.STRING)}
FROM ` +
this._escapeDDL +
table +
Expand Down
20 changes: 20 additions & 0 deletions test/pg_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ lab.experiment('pg', () => {
meta = _meta;

db = con;
Promise.promisifyAll(db);
});

lab.experiment('connections', () => {
Expand Down Expand Up @@ -968,6 +969,25 @@ lab.experiment('pg', () => {
});
});

lab.experiment('_getKV', () => {
let rows;

lab.before(async () => {
await db._createKV('test');
});

lab.test('can read written keys', async () => {
await db._insertKV('test', 'test', 'test123');
const e = await db._getKV('test', 'test');
expect(e).to.exist();
expect(e.value).to.equal('test123');
});

lab.after(async () => {
await db.dropTable('test');
});
});

lab.after(() => db.close());
});

Expand Down

0 comments on commit ec66452

Please sign in to comment.