@@ -15,7 +15,6 @@ const PostgresRelationDoesNotExistError = '42P01';
15
15
const PostgresDuplicateRelationError = '42P07' ;
16
16
const PostgresDuplicateColumnError = '42701' ;
17
17
const PostgresMissingColumnError = '42703' ;
18
- const PostgresDuplicateObjectError = '42710' ;
19
18
const PostgresUniqueIndexViolationError = '23505' ;
20
19
const logger = require ( '../../../logger' ) ;
21
20
@@ -906,15 +905,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
906
905
'CREATE TABLE IF NOT EXISTS "_SCHEMA" ( "className" varChar(120), "schema" jsonb, "isParseClass" bool, PRIMARY KEY ("className") )'
907
906
)
908
907
. catch ( error => {
909
- if (
910
- error . code === PostgresDuplicateRelationError ||
911
- error . code === PostgresUniqueIndexViolationError ||
912
- error . code === PostgresDuplicateObjectError
913
- ) {
914
- // Table already exists, must have been created by a different request. Ignore error.
915
- } else {
916
- throw error ;
917
- }
908
+ throw error ;
918
909
} ) ;
919
910
}
920
911
@@ -2450,23 +2441,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
2450
2441
: fieldNames . map ( ( fieldName , index ) => `$${ index + 3 } :name` ) ;
2451
2442
const qs = `CREATE INDEX IF NOT EXISTS $1 :name ON $2 :name ( $ { constraintPatterns . join ( ) } ) `;
2452
2443
await conn.none(qs, [indexNameOptions.name, className, ...fieldNames]).catch(error => {
2453
- if (
2454
- error.code === PostgresDuplicateRelationError &&
2455
- error.message.includes(indexNameOptions.name)
2456
- ) {
2457
- // Index already exists. Ignore error.
2458
- } else if (
2459
- error.code === PostgresUniqueIndexViolationError &&
2460
- error.message.includes(indexNameOptions.name)
2461
- ) {
2462
- // Cast the error into the proper parse error
2463
- throw new Parse.Error(
2464
- Parse.Error.DUPLICATE_VALUE,
2465
- 'A duplicate value for a field with unique values was provided'
2466
- );
2467
- } else {
2468
- throw error;
2469
- }
2444
+ throw error;
2470
2445
});
2471
2446
}
2472
2447
}
0 commit comments