Skip to content

Name collisions on the Table object #55

Closed
@panta82

Description

@panta82

I have a table with column "count".

When trying to create table definition using node-sql, I get "Table xxx already has column or property by the name of count". Of course, the conflict is with method count(). None of the other methods seem likely to collide with column names, but count is rather problematic, as it is a rather common column name.

Is there an 'official' strategy for avoiding this collision? Maybe some kind of fudge, where I define my column as "$count" or something, and it gets converted to "count", when generating SQL?

I was also considering using UPPERCASE or TitleCase column names, but that might create a problems with PostgreSQL, if names get quoted (as I presume they will be).

For now, I think I'll fork the lib locally and rename count to doCount or something, while hoping for a more elegant solution I have missed.

Thanks.

UPDATE:
Damn, I just went through older posts and noticed a duplicate by johndyoung.
Disregard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions