When inserting a BYTEA string in PostgreSQL the documentation says that such a string will occupy 1 or 4 bytes plus byte string length.
The question that I can't seem to find the answer to is what determines whether 1 or 4 bytes are added and is this effect consistent or will it vary depending on some factor or other?
Best Answer
I believe the answer is in this header comment of heaptuple.c: