Skip to content

Commit 1f9a4ed

Browse files
authored
Ignore duplicate_object error on create _Schema if not exists (#3668)
1 parent 6a2b972 commit 1f9a4ed

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import sql from './sql';
66
const PostgresRelationDoesNotExistError = '42P01';
77
const PostgresDuplicateRelationError = '42P07';
88
const PostgresDuplicateColumnError = '42701';
9+
const PostgresDuplicateObjectError = '42710';
910
const PostgresUniqueIndexViolationError = '23505';
1011
const PostgresTransactionAbortedError = '25P02';
1112
const logger = require('../../../logger');
@@ -416,7 +417,9 @@ export class PostgresStorageAdapter {
416417
conn = conn || this._client;
417418
return conn.none('CREATE TABLE IF NOT EXISTS "_SCHEMA" ( "className" varChar(120), "schema" jsonb, "isParseClass" bool, PRIMARY KEY ("className") )')
418419
.catch(error => {
419-
if (error.code === PostgresDuplicateRelationError || error.code === PostgresUniqueIndexViolationError) {
420+
if (error.code === PostgresDuplicateRelationError
421+
|| error.code === PostgresUniqueIndexViolationError
422+
|| error.code === PostgresDuplicateObjectError) {
420423
// Table already exists, must have been created by a different request. Ignore error.
421424
} else {
422425
throw error;

0 commit comments

Comments
 (0)