Ff00ff/mammoth

Table names which are keywords cause invalid sql statement errors

Closed this issue · 4 comments

Hi,

first of all, thx a lot for this great library!

I'm running into issues with table names which are keywords (I assume that column names could cause trouble too). A table named user for example is currently not working. It could be solved by quoting table names, but it seems that's not yet supported. It would be awesome if there is a solution for this.

You are right and your suggested solution sounds good. I do want to avoid always escaping tables and columns (the queries end up being so messy) so it would be nice to only escape if it's considered a reserved keyword.

I found a list at https://www.postgresql.org/docs/12/sql-keywords-appendix.html. This also includes user. I'm thinking of using this list to determine whether the tables or columns should be quoted. Thoughts?

Sounds good, I would be fine with both solutions.

This is on master now. Will be released later this week.

It seems I still have an issue here. My table is called order which is not properly double quoted in the following statement db.deleteFrom(db.order)