Closed andymitchell closed 3 months ago
I've had plenty of these kinds of errors. The RuntimeError: memory access out of bounds
errors typically go away with a reload and the RuntimeError: null function or function signature mismatch
can be due to actual errors, for which this is not a very good error message. If memory serves I was getting the latter from a VIEW
that was trying to do something illegal in the context of a ::json
coercion on certain values in certain rows. I have regularly also been getting error messages about illegal nodes.
@AntonOfTheWoods Sadly in this case, the RuntimeError: memory access out of bounds
is happening consistently. I'm executing the code in Jest, so it's restarting Pglite on each run.
@AntonOfTheWoods Sadly in this case, the
RuntimeError: memory access out of bounds
is happening consistently. I'm executing the code in Jest, so it's restarting Pglite on each run.
@andymitchell it is becoming clear that any sort of error being raised (incorrectly spelt column name in a select
, etc.) cause the db to enter an invalid/broken state, and you can definitely expect errors of various kinds, including this one. My understanding of the code above is that you are testing whether errors get managed properly... so you are generating an error. It looks like that is a sure way to break things currently, so your code would be a welcome addition to the pglite
test suite :-) !
Hey, thanks for the report.
We are working on a new version of PGlite that should solve the bug where it ends up in an invalid state after throwing an error. I'm hopeful we will be able to get a version out in about two weeks time. (I'm away next week)
After quite some time debugging the init migrations file, I found that INT index creation statements are causing the "memory access out of bounds" error in my case. I commented out lines like the following from the file generated by Drizzle:
CREATE INDEX IF NOT EXISTS "Company_primaryContactId_idx" ON "Company" USING btree ("primaryContactId" int4_ops);--> statement-breakpoint
Hope this helps!
Loving PGLite so far btw!
Fixed in PGlite v0.2.0.alpha
@samwillis Pglite has been a fantastic transformation for testing, and the speed is incredible compared to Pgmock.
Sadly, I've written a valid plpgsql function that triggers errors in Pglite:
Replicating code
What the function
testhelper_throws_ok
is doingIt accepts a line of SQL that it expects to fail. If the SQL errors, the function catches it and does nothing. If the SQL runs cleanly, the function throws an exception.
(It's an alternate implementation of pgtap's throws_ok)
A few observations
testhelper_throws_ok
. But the exact error varies depending on how it's invoked (see the two examples in the code below).