Variable-length binary string type in PostgreSQL
Questions tagged [bytea]
189 questions
2
votes
1 answer
Order by size postgres bytea
I have images stored in a postgresql 9.1 database table in bytea fields.
I want to do a query to order them by size and show their size.
I need this because there are some big images that are causing delay issues.

Felipe
- 37
- 1
- 5
2
votes
1 answer
Should I unescape bytea field in C-function for Postgresql and if so - how to do it?
I write my own C function for Postgresql which have bytea parameter. This function is defined as followed
CREATE OR REPLACE FUNCTION putDoc(entity_type int, entity_id int,
doc_type text, doc_data bytea) RETURNS text
AS 'proj_pg',…

Pupkov-Zadnij
- 1,342
- 2
- 11
- 21
1
vote
2 answers
bytea in postgres storing and retrieving bytes
I am trying to understand how to work with binary data in postgresql (v 8.3).
Let's say I have a following table
Table "public.message"
Column | Type | Modifiers
---------+---------+-----------
id | integer |
message | bytea |
I would…

t0x13
- 351
- 2
- 10
- 24
1
vote
1 answer
Storing / Extracting images from database with php
I am using PHP 5.3.5 and postgreSQL. I am storing and extracting images from database.
For storing i am doing this:
$escaped_data = base64_encode(file_get_contents($_FILES['fileUpload']['tmp_name']));
…

KillCloud
- 17
- 5
1
vote
0 answers
type method not resolved in @Type annotation of hibernate. unable to persist Set of strings in hibernate
We are trying to persist a Set to a column "errors" in postgres db using hibernate.
As per schema definition, bytea is the data type of column "errors"
There is no mapping like onetomany or manytomany are not applicable
We tried to use custom types…

Shanmuga Priya S
- 11
- 2
1
vote
1 answer
Is there a way to display image encoded into a string longer than 100 000 characters? (Java, Spring, Thymeleaf)
So, i have a form that allows user to upload an image, which will be encoded with IOUtils.toByteArray and persisted to a database as a bytea. In a controller method i get this byte array and encode it to string:
@GetMapping("/{user_id}")
public…

no way
- 29
- 5
1
vote
0 answers
Error handling misfires: Couldn't retrieve trigger: Cannot convert the column of type BYTEA to requested type long in Postgres Quartz schedular
I am new to java. In my project we are using quartz scheduler for scheduling jobs, the service is connected to Postgres earlier it was MYSQL now we are migrating to Postgres. While running the application I am getting error "Error handling misfires:…

Vishnuraj
- 11
- 2
1
vote
3 answers
Retrieve and send a PostgreSQL bytea image
I have an app which uses AWS Lambda functions to store images in a AWS PostgreSQL RDS as bytea file types.
The app is written in javascript and allows users to upload an image (typically small).

tdammon
- 610
- 2
- 13
- 39
1
vote
0 answers
Python Insert pickle file/object in postgres DB
I need to insert my ml_model.pkl file/object in Postgres DB bytea column.
Is it possible to insert any files in Postgres DB bytea column?

Raj Mohan
- 11
- 1
1
vote
0 answers
Is there a nice way to convert a null-delimited bytea column to a text[] in postgres?
I'm currently writing some code which reads the pg_trigger catalog: specifically the tgargs column:
tgargs bytea
Argument strings to pass to trigger, each NULL-terminated
There's two problems I think I need to solve:
Is there a postgres function…

nyctef
- 474
- 6
- 12
1
vote
2 answers
Save Image Files as bytea in PostgreSQL and retrieving them to display on HTML template
Yes I know it's a bad idea/bad practice to save images in a database, nevertheless I have to as those are the requirements of my professor which is why I have to achieve it anyways.
The setup:
I have a user table with an img column of type bytea…

Deluroth
- 53
- 1
- 7
1
vote
0 answers
Update row with Buffer into bytea type column, using Postgres and NodeJS
I'm trying to store a Buffer into a bytea type column. I'm using a Postgres database and I have successfully connected to this database with node-postgres. I am able to update any other field, but I just can't find out what the syntax is to properly…

Richard van Hees
- 11
- 2
1
vote
1 answer
Count Zero and/or Non-Zero bytes in a bytea/string
I have a field in bytea format, and I'm trying to calculate how many zero bytes are in the field (postgresql).
Example…

Michael S
- 25
- 4
1
vote
1 answer
Query BYTEA in Postgres using sqlx
I have the following table in Postgres DB:
CREATE TABLE resources_index (
hash varchar NOT NULL,
"name" varchar NOT NULL,
viewentry_id varchar NOT NULL,
value bytea NULL
);
I'd like to execute the following prepared statement using…

Marko Seidenglanz
- 107
- 2
- 8
1
vote
0 answers
Convert Hex/Binary/Base64 to IP address in Postgresql
How can we convert BYTEA datatypes to an IP address in INET or TEXT/VARCHAR in Postgres?
Tried all the ENCODE(), DECODE() with 'hex', 'base64' combinations with no luck.
For context, in MySQL, we can use INET6_NTOA('some hex') to get an IP…

qwerty0033
- 31
- 1