pg-mem
pg-mem copied to clipboard
Sequelize findAll with include fails but works with postgresql
Describe the bug
pg-mem fails while psql doesn't
'Unexpected quoted_word token: "reserved_timeslots". Instead, I was expecting to see one of the following:\n' +
'\n' +
' - A "kw_with" token\n' +
' - A "kw_select" token\n' +
' - A "word" token\n' +
' - A "kw_with" token\n' +
' - A "lparen" token\n' +
'\n',
To Reproduce
https://pastebin.com/tnf6hZ9U
With the command itself being:
SELECT "timeslot"."id", "timeslot"."start", "timeslot"."end", "timeslot"."airfield_id" AS "airfieldId", "reservations"."id" AS "reservations.id", "reservations"."start" AS "reservations.start", "reservations"."end" AS "reservations.end", "reservations"."info" AS "reservations.info", "reservations->reservedTimeslot"."reservation_id" AS "reservations.reservedTimeslot.reservationId", "reservations->reservedTimeslot"."timeslot_id" AS "reservations.reservedTimeslot.timeslotId" FROM "timeslots" AS "timeslot" LEFT OUTER JOIN ( "reserved_timeslots" AS "reservations->reservedTimeslot" INNER JOIN "reservations" AS "reservations" ON "reservations"."id" = "reservations->reservedTimeslot"."reservation_id") ON "timeslot"."id" = "reservations->reservedTimeslot"."timeslot_id";
from
const returnedTimeSlots = await Timeslot.findAll({
include: {
model: Reservation,
attributes: ['start', 'end', 'info'],
},
});
pg-mem version
2.6.4
(nb: the version in your package.json version is often not precise enough... please run "cat ./node_modules/pg-mem/package.json | grep version" to tell which minor version is actually installed)