What's the easiest way to represent a bytea as a single integer in PostgreSQL?

后端 未结 4 1416
星月不相逢
星月不相逢 2021-01-05 15:09

I have a bytea column that contains 14 bytes of data. The last 3 bytes of the 14 contain the CRC code of the data. I would like to extract the CRC as a single i

4条回答
  •  礼貌的吻别
    2021-01-05 16:01

    If you want to store the CRC as a single integer in a separate column, I suggest converting it at insert- or update-time; then persist it together with the value for the bytea.

    You can do this in your application/business layer or use an insert/update trigger to fill the CRC column.

提交回复
热议问题