Skip to content
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

Sequelize querying column that doesn't exist #9064

Closed
REX500 opened this issue Feb 17, 2018 · 1 comment
Closed

Sequelize querying column that doesn't exist #9064

REX500 opened this issue Feb 17, 2018 · 1 comment

Comments

@REX500
Copy link

REX500 commented Feb 17, 2018

What are you doing?

Querying a database table with .all() function.

What do you expect to happen?

I should get all the entries currently in the table.

What is actually happening?

Error code: 42703
Sequelize returning modelName.columnThatDoesntExist doesn't exist.
So mappings table has 5 columns: id, yearId, clientId, createdAt, updatedAt.
Checked trough pgAdmin and also models/migrations.
There is no reason sequelize should also query mappingsId column...
Mappings table has sub table called mappingStatus. Each mappings table can have many mappingStatuses which have mappingId column which is foreign key connected to mappings id column.
I tried including mappingStatus and no charm...
Note that this issue wasn't here until I deleted the tables and migrated again.

Output, either JSON or SQL
name: 'error',
length: 102,
severity: 'ERROR',
code: '42703',
detail: undefined,
hint: undefined,
position: '62',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'parse_relation.c',
line: '3194',
routine: 'errorMissingColumn',
sql: 'SELECT "id", "clientId", "yearId", "createdAt", "updatedAt", "mappingId" FROM "mappings" AS "mappings";' },
sql: 'SELECT "id", "clientId", "yearId", "createdAt", "updatedAt", "mappingId" FROM "mappings" AS "mappings";' }

__Dialect: postgres
__Dialect version: 9.5.10
__Sequelize version: 3.2.0
Tested with latest release: No

@sushantdhiman
Copy link
Contributor

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

2 participants