feat: add support for Postgres 14 (#7644)

This commit is contained in:
Corey
2021-10-31 15:49:03 -04:00
committed by GitHub
parent 28fa7167e8
commit 090350a7a0
8 changed files with 73 additions and 17 deletions

View File

@@ -1983,10 +1983,10 @@ export class PostgresStorageAdapter implements StorageAdapter {
return this._client
.one(qs, values, a => {
if (a.approximate_row_count != null) {
return +a.approximate_row_count;
if (a.approximate_row_count == null || a.approximate_row_count == -1) {
return !isNaN(+a.count) ? +a.count : 0;
} else {
return +a.count;
return +a.approximate_row_count;
}
})
.catch(error => {
@@ -2111,7 +2111,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
columns.push(
`EXTRACT(${
mongoAggregateToPostgres[operation]
} FROM $${index}:name AT TIME ZONE 'UTC') AS $${index + 1}:name`
} FROM $${index}:name AT TIME ZONE 'UTC')::integer AS $${index + 1}:name`
);
values.push(source, alias);
index += 2;