PANIC: index out of bounds: the `len` is `1` but the `index` is `1`
erawk opened this issue · comments
Ed Lui commented
Just crashed while issuing using queryRaw
and executeRaw
to do some complex queries and updates.
Using the unaliased table
versions below worked:
SELECT a.*
FROM account AS a
INNER JOIN public.user ON a."userId" = public.user."parentId"
WHERE a.type = 'parent' AND a."childId" IS NULL AND public.user.id IS NOT NULL)
Broken version (note the table alias for public.user AS u
)
SELECT a.*
FROM account AS a
INNER JOIN public.user AS u ON a."userId" = u."parentId"
WHERE a.type = 'parent' AND a."childId" IS NULL AND u.id IS NOT NULL)
Versions
Name | Version |
---|---|
Node | v12.16.1 |
OS | darwin |
Prisma Client | 2.8.0 |
Logs
prisma-client {
prisma-client engineConfig: {
prisma-client cwd: '***/api/prisma',
prisma-client enableDebugLogs: false,
prisma-client enableEngineDebugMode: undefined,
prisma-client datamodelPath: '***/api/node_modules/.prisma/client/schema.prisma',
prisma-client prismaPath: undefined,
prisma-client engineEndpoint: undefined,
prisma-client generator: {
prisma-client name: 'client',
prisma-client provider: 'prisma-client-js',
prisma-client output: '***/api/node_modules/@prisma/client',
prisma-client binaryTargets: [],
prisma-client previewFeatures: [],
prisma-client config: {}
prisma-client },
prisma-client showColors: false,
prisma-client logLevel: undefined,
prisma-client logQueries: undefined,
prisma-client flags: [],
prisma-client clientVersion: '2.8.0',
prisma-client enableExperimental: [],
prisma-client useUds: undefined
prisma-client }
prisma-client }
plusX Execution permissions of ***/api/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of ***/api/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of ***/api/node_modules/.prisma/client/query-engine-darwin are fine
prisma-client Prisma Client call:
prisma-client prisma.queryRaw(
prisma-client SELECT a.*
prisma-client FROM account AS a
prisma-client INNER JOIN public.user AS u ON a."userId" = u."parentId"
prisma-client WHERE a.type = 'parent' AND a."childId" IS NULL AND u.id IS NOT NULL)
prisma-client Prisma Client call:
prisma-client prisma.executeRaw(
prisma-client UPDATE ONLY account AS a
prisma-client SET "childId" = public.user.id,
prisma-client name = 'Parent Wallet'
prisma-client FROM public.user AS u
prisma-client WHERE a.type = 'parent'
prisma-client AND a."childId" IS NULL
prisma-client AND u.id IS NOT NULL
prisma-client AND u."parentId" = a."userId")
Harshit Pant commented
@erawk Can you please share the SQL schema of these tables? That would aid in reproducing this issue, thanks!
Tim Suchanek commented
Ping @erawk
Harshit Pant commented
I am going to close this as its been 3 months now and there is no activity here.
Please reply if you want us to take another look.`