You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE OR REPLACE FUNCTION cbor.next_indefinite_text_string
(
cbor BYTEA,
encode_binary_format TEXT
)
RETURNS cbor.next_state
IMMUTABLE
BEGIN ATOMIC
WITH RECURSIVE x AS
(
SELECT
0 AS i,
next_indefinite_text_string.cbor AS remainder,
''::TEXT AS text_string
UNION ALL
SELECT
x.i + 1,
next_item.remainder,
x.text_string ||
CASE
WHEN (get_byte(x.remainder,0)>>5)&'111'::BIT(3)::INTEGER = 3
THEN (next_item.item#>>'{}')
ELSE cbor.raise('incorrect substructure of indefinite-length text string (may only contain definite-length strings of the same major type)',NULL,NULL::text)
END
FROM x
JOIN LATERAL cbor.next_item(x.remainder, encode_binary_format) ON TRUE