Error -> index = err.message.match(/violates foreign key constraint \"(.+?)\"/)[1];

16 views
Skip to first unread message

Fernando Cagale

unread,
Apr 26, 2015, 10:41:46 PM4/26/15
to sequ...@googlegroups.com
Hello,
You know tell me if this situation has been resolved!

Executing (default): DELETE FROM "Operadoras" WHERE "id" IN (SELECT "id" FROM "O
peradoras"
WHERE "id" = 1 LIMIT 1)
C
:\Users\Fernando\NodeJS\template\node_modules\sequelize\lib\dialects\postgre
s
\query.js:357
     
index = errMessage.match(/violates foreign key constraint \"(.+?)\"/)[1];
                                                                         
^
TypeError: Cannot read property '1' of null
    at
module.exports.Query.formatError (C:\Users\Fernando\NodeJS\template\no
de_modules
\sequelize\lib\dialects\postgres\query.js:357:78)
    at
null.<anonymous> (C:\Users\Fernando\NodeJS\template\node_modules\seque
lize
\lib\dialects\postgres\query.js:106:21)
    at emit
(events.js:107:17)
    at
Query.handleError (C:\Users\Fernando\NodeJS\template\node_modules\pg\l
ib
\query.js:99:8)
    at
null.<anonymous> (C:\Users\Fernando\NodeJS\template\node_modules\pg\li
b
\client.js:166:26)
    at emit
(events.js:107:17)
    at
Socket.<anonymous> (C:\Users\Fernando\NodeJS\template\node_modules\pg\
lib
\connection.js:109:12)
    at
Socket.emit (events.js:107:17)
    at readableAddChunk
(_stream_readable.js:163:16)
    at
Socket.Readable.push (_stream_readable.js:126:10)



Saw
an issue about this issue https://github.com/sequelize/sequelize/issues/2753.

I am going through this situation!

    "pg": "^4.3.0",
    "pg-hstore": "^2.3.2",
    "sequelize": "^2.0.5",

Mick Hansen

unread,
Apr 27, 2015, 3:40:20 AM4/27/15
to Fernando Cagale, sequ...@googlegroups.com
Are you using a database with another language than english?
Try upgrading to 2.1.0 which should handle foreign databases better.
--
Mick Hansen
@mhansendev
mhansen.io

Fernando Cagale

unread,
Apr 27, 2015, 7:12:53 AM4/27/15
to sequ...@googlegroups.com, fernando...@gmail.com
Hello!

I'm using Postgres database, I'm Brazilian so the query are different.

I will update the version to audition.

Sorry for my English, I'm using google translator.

Thank you.
Reply all
Reply to author
Forward
0 new messages