Is this a bug or I am just an idiot
So basically I have 3 tables named as chapter, volume and novel.
I was trying to get all the novels (which is 8 right now), and latest 5 chapters of these novels.
To achieve this I was trying to use subquery of volume and chapter combined and then giving them a row number.
Because volume and chapter both have a column name as number somehow it is causing issue 😕 .
For reference: I'm using supabase with @vercel/postgres
My error:
Solution:Jump to solution
@Shashank Hi, I'm pretty sure the issue is to do with the chapter number and volume number, and the fix should be as simple as this:
...
5 Replies
Solution
@Shashank Hi, I'm pretty sure the issue is to do with the chapter number and volume number, and the fix should be as simple as this:
This should resolve the ambiguity the error is describing
Yupp it does but the problem is it also takes away the power of typescript for chapterNumber and volumeNumber
I guess this is the workaround for now
Oh yeah, that can be an issue. Adding to the already kinda verbose solution, you can also add
.mapWith(Number)
to TS knows it's a number (add it before .as()
)
We'll look into aliasing columns without this clunky behavior sometime soonyeah that will be gr8 for now I'm planning to use relational queries. It fits better with my use case.