Closed mcannonbrookes closed 11 years ago
Mate - any feedback or can I help on this one?
FYI I worked around it by converting the date to a PG acceptable String in my own code - but that seemed wrong?
I'm going to use your suggestion (and borrow code from pg for now). Thank you for your feedback.
About ORM escaping things, I'm looking to change the drivers in the future to use prepared statements and so avoid escaping both on ORM or node drivers. But for now I'll leave as it is.
Trying to insert a model with a Date type in Postgres results in the following error:
Looking in the source code, it seems that
lib/Dialects/postrgresql.js
methodescapeVal
doesn't handle Date objects properly yet.Modifying the
switch
statement to look more like this:seems to work - but I had to steal
dateToString
method from the nodepg/lib/utils.js
. This works but probably isn't the nicest solution so I won't send a PR.Ideally this library would be a true dependency maybe and you could re-use their methods directly? (doesn't seem like your ORM library should be doing the escaping itself, that seems a little like the job of the core driver maybe?)