Skip to content

Query to information_schema.columns selects columns from all schemas #32

@rwest202

Description

@rwest202

const getColumns = 'select * from information_schema.columns ' +
`where table_name = '${mappedType}'`

Let's say I have a schema named schema-v1 and another named schema-v2 that both have a table called users. If schema-v1 has a column in users like users.email then the below if statement will wrongly think that the column exists in schema-v2. This is because information_schema.columns returns a list of columns in all schemas.

if (!tableColumns[type].some(row => row.column_name === field) &&

Solution should be to specify the exact schema to search in.

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