patternsqlMinor
LIKE search in bytea datatype (PostgreSQL)
Viewed 0 times
postgresqldatatypesearchbytealike
Problem
Table:
This statement:
Error message:
What can I do to make this statement not fail?
\d blob
Column | Type | Collation | Default
---------+--------------+-----------+------------------------------------------
id | integer | | nextval('modlink_blob_id_seq'::regclass)
content | bytea | |This statement:
SELECT COUNT(*) "job" INNER JOIN "blob" ON ("job"."input_id" = "blob"."id")
WHERE UPPER("blob"."content"::text) LIKE UPPER('%csv%');Error message:
ERROR: invalid memory alloc request size 1989028364What can I do to make this statement not fail?
Solution
Maybe you can use position function https://www.postgresql.org/docs/13/functions-binarystring.html
WHERE position('csv'::bytea in "blob"."content") > 0Code Snippets
WHERE position('csv'::bytea in "blob"."content") > 0Context
StackExchange Database Administrators Q#220130, answer score: 4
Revisions (0)
No revisions yet.