Skip to content

db hint #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vitaly-t opened this issue Jun 22, 2016 · 0 comments
Open

db hint #5

vitaly-t opened this issue Jun 22, 2016 · 0 comments

Comments

@vitaly-t
Copy link
Contributor

about this code:

/**
 * Wrap name with double-quotes to work with keyword properly
 * see
 * http://www.postgresql.org/docs/9.5/static/sql-syntax-lexical.html
 * @param {String} name the name to escape
 * @param {bool} remove the flag to remove double-quotes
 * @returns {String} the escaped name
 * @private
 */
function _escapeName(name, remove) {
  if (/".*"/.test(name)) {
    return remove ? name.substring(1, name.length - 1) : name;
  }
  return remove ? name : `"${name}"`;
}

You should instead use the proper query formatting provided by pg-promise.

In this particular case - method as.name.

See also SQL Names.

@vitaly-t vitaly-t changed the title dn hint db hint Jun 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant