Variable-length binary string type in PostgreSQL
Questions tagged [bytea]
189 questions
1
vote
1 answer
SvelteKit and retrieving images from PostgreSQL via node-postgres
Storing ~100 JPEGs (24K-100K each) in a table in PostgreSQL as a bytea column.
The
tag src attributes reference the SvelteKit endpoint:
Getting this error:
Invalid response from route…

nstuyvesant
- 1,392
- 2
- 18
- 43
1
vote
1 answer
How can I manually insert a .png or .jpeg file into bytea column in PostgreSQL?
I'm currently using PostgreSQL 4.38 on Windows 10, I'm trying to insert an image (.png file) manually into bytea column in PostgreSQL, but upon executing the data, it says that invalid input syntax for type bytea. What should be the right procedure…

Allyn Villacorta
- 41
- 10
1
vote
1 answer
RpostgreSQL how to transform bytea column RDS format in dataframe
I need to extract data from a BYTEA field of a postgeSQL database. In the BYTEA field, the data is stored in the RDS format (it is the contents of a .rds file created by the command saveRDS corresponding to a dataframe). Using the package…

Laurent
- 21
- 4
1
vote
1 answer
Bytea persist and retrieval in Postgresql with Spring Data JPA and Angular
I am sending an array from my Angular frontend to Spring Boot backend and this array is persisted as a bytea in the postgresql db, but when i retrieve it via a request from the frontend to the backend I get a string of characters.
I would be highly…

Ani
- 65
- 1
- 2
- 11
1
vote
0 answers
PostgreSQL Bytea column as varchar results
I have this client where we installed a PGSQL server on his server (PGSQL 13 on port 5432)
There already was a postgresql server installed (8.3, port 15432).
No problems here.
Our application has a few 'bytea' columns where we store some encrypted…

Morph
- 33
- 3
1
vote
1 answer
Why does YugaByteDB YSQL select query return unexpected bytes when using bytea data type?
I am trying to store some binary data into yugabytedb on my laptop in minikube, so I used the bytea datatype as the documentation says.
But when it comes to retrieving the binary data back using a select query, the bytes returned are very different…

Rodgers Ategyeka
- 59
- 8
1
vote
1 answer
Postgres and bytea columns appearing weird
I dumped a database and imported it into a different server. One of the tables has a bytea column and has a single row of data. On the original server, if I SELECT * FROM users;, it shows the correct value as @. - however, when I do that same select…

Arcane Feenix
- 120
- 1
- 8
1
vote
1 answer
Double encoded bytea in PostgreSQL
I'm storing binary data in a bytea field, but have during the import converted it twice to hex. How can I undo the double encoding?
My binary file starts with the character "0". In hex that's the character 30. In psql I expect to see the string that…

Kurt Roeckx
- 173
- 1
- 5
1
vote
1 answer
Equivalent of Convert varbinary in PostgreSQL for bytea
What is the equivalent of Convert varbinary in PostgreSQL for bytea? Here's a SQL Server example:
CONVERT(varbinary(MAX),…

cxc
- 201
- 2
- 10
1
vote
2 answers
Postgresql Query to select entry keys in bytea field
I'm working with a Postgresql DB.
table is ticketlines containes a bytea field called attributes
Sample of field contents in JSON view:

Aaron Mills
- 11
- 2
1
vote
1 answer
Concat setof bytea into single bytea
I have a plpgsql function in Postgres 12 that returns SETOF bytea, which is then made into a single bytea on the server:
CREATE OR REPLACE FUNCTION public.get_tile(z integer, x integer, y integer)
RETURNS SETOF bytea
LANGUAGE plpgsql
STABLE…

Avocado
- 871
- 6
- 23
1
vote
1 answer
Problem with Java LocalDate / LocalDateTime fields mapped in PostgreSQL colunms
I have an application that contains some JPA classes that are using LocalDate / LocalDateTime fields and these fields are being mapped into PostgreSQL columns as Bytea.
The greatest problem with this approach is that I can't do queries with SQL,…

All Pereira
- 139
- 1
- 2
- 13
1
vote
2 answers
how to convert numeric to byte as similer to java in postgres
I am trying to replicate some java code in Postgres.
The operation, I need to perform is to convert Java BigInteger to byte array
Java Code:
public class Main {
public static void main(String[] args) {
BigInteger n = new…

Tajinder
- 2,248
- 4
- 33
- 54
1
vote
1 answer
Insert COPY command's file result into a table
I have a postgresql function that creates an csv file like below.
CREATE FUNCTION public.exportsnapshot()
RETURNS void AS $$
LANGUAGE 'plpgsql'
BEGIN
COPY (my_query) TO 'tmp/test.csv' With DELIMITER ';' CSV HEADER;
END; $BODY$;
Is there…

Lala
- 134
- 8
1
vote
1 answer
How to write null characters to a bytea column using psycopg2 in Python
I'm trying to write binary data into bytea column in PostgreSQL table. My data contains null characters and I get following error.
ValueError: A string literal cannot contain NUL (0x00) characters.
This is my code.
import numpy as np
fft = [0.0,…

Salman Azmat
- 298
- 6
- 18