Skip to content

Commit

Permalink
Merge pull request #203 from mingyang91/master
Browse files Browse the repository at this point in the history
fix issue #202
  • Loading branch information
Umed Khudoiberdiev committed Jan 14, 2017
2 parents e07d1c1 + 46cf6b7 commit 73c80e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/driver/postgres/PostgresQueryRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ where constraint_type = 'PRIMARY KEY' and tc.table_catalog = '${this.dbName}'`;
* Checks if column with the given name exist in the given table.
*/
async hasColumn(tableName: string, columnName: string): Promise<boolean> {
const sql = `SELECT * FROM information_schema.tables WHERE table_catalog = '${this.dbName}' AND table_schema = '${this.schemaName}' AND table_name = '${tableName}' AND column_name = '${columnName}'`;
const sql = `SELECT * FROM information_schema.columns WHERE table_catalog = '${this.dbName}' AND table_schema = '${this.schemaName}' AND table_name = '${tableName}' AND column_name = '${columnName}'`;
const result = await this.query(sql);
return result.length ? true : false;
}
Expand Down

0 comments on commit 73c80e3

Please sign in to comment.