문제

I need to make a query based on a specific element of a bytea column in PostgreSQL. I tried the following query:

select * from my_table where bytea_column[4] between 160 and 183 limit 1

-but it gives me ERROR: cannot subscript type bytea because it is not an array.

Is there a way I can select a specific element of a bytea? I would like to avoid casting it to text and using like %%.

도움이 되었습니까?

해결책

Use the get_byte function. This allows you to retrieve a single byte.

Alternatively you can use the substring function to retrieve a sequence of bytes.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top