Skip to content

Simple Relational Query throws an error #166

@AHgPuK

Description

@AHgPuK
const SQLParser = require('@synatic/noql');

Promise.resolve()
.then(async function () {

	const query = `select A.name, B.name, C.name
from \`user-books\` as UB, books as B, users as A, authors as C
where UB.book = B._id AND UB.user = A._id AND B.author = C._id
`;

	const parsedSQL = SQLParser.parseSQL(query);

	console.log(parsedSQL);

})
.catch(err => console.error(err));

Throws an error

TypeError: Cannot read properties of undefined (reading 'left')
    at shouldPrefixSide ($project\node_modules\@synatic\noql\lib\make\makeJoinForPipeline.js:236
:30)
    at makeJoinPart ($project\node_modules\@synatic\noql\lib\make\makeJoinForPipeline.js:104:24)
    at Object.makeJoinForPipeline ($project\node_modules\@synatic\noql\lib\make\makeJoinForPipel
ine.js:48:9)
    at Object.makeAggregatePipeline ($project\node_modules\@synatic\noql\lib\make\makeAggregateP
ipeline.js:234:52)
    at makeMongoAggregate ($project\node_modules\@synatic\noql\lib\make\index.js:26:47)
    at SQLParser.parseSQL ($project\node_modules\@synatic\noql\lib\SQLParser.js:69:16)
    at $project\index.js:11:30

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