I want to cast a hex string to bit on redshift as follow:
select 'x827ccb0eea8a706c'::bit(64)
-> This statement works well.
The problem is that I retrieve the 'x827ccb0eea8a706c' value as a varchar/text.
If the value is casted as a string, I can't convert it to bit:
select 'x827ccb0eea8a706c'::text::bit(64)
-> Doesn't work!
How can I solve this issue? How can I cast text to bit?
Two issues here:
The intended query can be written as:
SELECT FROM_HEX(substr(md5('12345'),1,16))::BIGINT;