Need to De-Toast #4

theory opened this Issue Oct 15, 2012 · 5 comments

2 participants


RhodiumToad tells me on IRC:

justatheory: RhodiumToad: Does semver_out() look right to you [here](
RhodiumToad: justatheory: no, you're missing a detoast
justatheory: How do I detoast stuff?
RhodiumToad: and remember to use PG_FREE_OF_COPY in any btree comparison funcs
RhodiumToad: you should have something like this:
RhodiumToad: #define DatumGetSemver(x) ((semver *) PG_DETOAST_DATUM(x))
RhodiumToad: #define PG_GETARG_SEMVER(n) DatumGetSemver(PG_GETARG_DATUM(n))
RhodiumToad: strictly those should have P or _P on the ends

So we should do that. Not likely to often have long values, so maybe it doesn't need to be toasted at all?


I guess this could easily be tested by setting the column attribute to always toast


How would one do that?


bump @samv.


Added a macro in 3ab1c6a, but when I asked RhodiumToad about this again, he realized that, because the CREATE TYPE statement does not specify a storage type, the type is always "plain", and therefore never toasted. So no need to de-toast.


And in 8d0dbe8, I removed all calls to PG_FREE_IF_COPY(), as it is only needed for toastable values in btree functions or operators, and, again, semvers are not toastable. We fetch a few text values that are toastable, but not in btree operators or functions.

@theory theory closed this Jun 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment