Is there a way to create at type-safe BLOB? There's no natural string representation so a traditional type seems out but a new composite type like
CREATE TYPE jpeg AS ( image BLOB )
isn't as transparent as I would like. There would be CAST functions to transparently convert between a BLOB and the typesafe type (modulo correct format, of course).
The alternative is to create a BLOB column and add a check constraint to verify the column contains the expected type of data but that isn't as intuitive as "image jpeg".
(BTW I'm using jpeg as an example so don't read too much into it.)
Thanks,
Bear