dmfay / massive-js

A data mapper for Node.js and PostgreSQL.
2.49k stars 158 forks source link

pg-promise custom type formatting update #505

Closed vitaly-t closed 6 years ago

vitaly-t commented 7 years ago

This change will be needed, if you eventually get to upgrade pg-promise to v7.1.0 or later. That version brought it some changes that are non-breaking for any client, but for your integration this change will be needed.

So, do not accept this PR before you upgrade pg-promise to v7.1.0 or later! :wink:

dmfay commented 6 years ago

Rolled this into the driver upgrade commit, thanks!

vitaly-t commented 6 years ago

A, finally! :smile:

vitaly-t commented 6 years ago

@dmfay As I revisited this with this question: https://github.com/vitaly-t/pg-promise/issues/563

I would say that the following approach is better:

const rawSQL = pgp.as.format(script.sql);

The formatting method knows internally how to deal with all types that support Custom Type Formatting (both explicit and symbolic syntax), and QueryFile is just one such type.