Skip to content

Indexes Using columns not quoted #47

@toddpi314

Description

@toddpi314

If you have a case-sensitive model attribute and create a mutli-column index like this:

var User = schema.define('User', {
    userId: {
        type: Number
    },
    messageId: {
        type: Number
    }
}, {
    indexes: {
        indexPrimary: {
            columns: 'userId,messageId',
            type: 'btree'
        }
    }
});

The constructed sql doesn't wrap the column names for the btree's Using context:

CREATE  INDEX "indexPrimary" ON "User" USING btree (userId,messageId)

This will result in something like "Cannot find column 'userid'" failure.

Workaround (manually adding the quotes inline):

        indexPrimary: {
            columns: '"userId","messageId"',
            type: 'btree'
        }

I am guessing that this should be handled in the library itself, as it does this for single columns perfectly.

Thanks for the hard work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions