Questions tagged [bytea]

Variable-length binary string type in PostgreSQL

189 questions
5
votes
1 answer

PostgreSQL replication with rubyrep

I'm new to rubyrep and currently using rubyrep-1.2.0 version for PostgreSQL Master-Master replication. All data types except bytea are getting replicated properly. While replicating bytea column, it seems like the data is escaped twice. I'm using…
5
votes
5 answers

Convert a bytea column to OID while retaining values

I'm trying to alter a bytea column to have type oid and still retain the values. I have tried using queries like: ALTER TABLE mytable ADD COLUMN mycol_tmp oid; UPDATE mytable SET mycol_tmp = CAST(mycol as oid); ALTER TABLE mytable DROP COLUMN…
Petter
  • 4,053
  • 27
  • 33
4
votes
0 answers

How convert bytea in timestamp?

I have an entity with a property of type java.time.Instant. @ApiModelProperty(required = false) private Instant date; I am using PostgreSQL and this column was converted to bytea. The hibernate show in the console a query like this: select…
Luciano Borges
  • 817
  • 3
  • 12
  • 31
4
votes
1 answer

Data storage on DB: PostgreSQL "bytea" on Server to SQLite "BLOB" on Mobile App

I want to use image storage on DB and not URL. On my server side I use PostgreSQL and I read here that "bytea" is the suggested format to use in order to store files. On my mobile app side, the DB is SQLite. It seems the data storage suggested…
nyluje
  • 3,573
  • 7
  • 37
  • 67
4
votes
1 answer

How to store file in postgres database using hibernate?

I am new to Hibernate. I need to store file in postgres, data type of the column is bytea. I looked around on internet for a working demo of this case, however I couldn't find any. Hibernate mapping :
Ketu
  • 1,608
  • 2
  • 14
  • 30
4
votes
2 answers

Displaying Image Stored as Binary in Postgre bytea Column

I'm stuck for hours working on this. Few solutions found over the Net but no one seems to help me. I am having problem to display an image on the browser using PHP that takes the image from Postgres DB with column type bytea. I'm sure I'm missing…
UserProg
  • 629
  • 1
  • 8
  • 22
3
votes
1 answer

Bytea to actual text value in postgresql

I have a table to store file information in postgresql. select id,filestream,name from Table_file_info Here filestream is bytea datatype. How to get bytea data into actual text (content of my file) in postgresql. I tried with below query: select…
Jagadeesh
  • 1,630
  • 8
  • 24
  • 35
3
votes
1 answer

PostgreSQL - How to convert current timestamp into bytea

I have migrated a database from SQL Server into PostgreSQL. A number of tables contain a ts column(timestamp) which stores the rowversion and is autogenerated in SQL server. When I converted the stored procedures into PostgreSQL, I found that…
3
votes
2 answers

PostgreSQL load images to DB

I've already know how to store images in DB, just use bytea type in my table And I've already can save images to DB via code in my project .net Core, I've just getting image by url and saving like there: using (HttpResponseMessage res = await…
Igor Cova
  • 3,126
  • 4
  • 31
  • 57
3
votes
3 answers

How to convert the PostgreSQL bytea value into Data URL value using PHP

PostgreSQL has this datatype called bytea. It is their version of a blob. In displaying images, png/jpg/gif, the current trend nowadays is to use Data URLs. My question is how to convert a bytea value into a Base64 Data URL value? References bytea…
Abel Callejo
  • 13,779
  • 10
  • 69
  • 84
3
votes
1 answer

how to convert base64 string to bytea in postgresql8.2

I need to convert base64 string to bytea type. But when I Executed SQL statements by the pgAdminIII: select decode("ygAAA", 'base64'); I got the following error message: ERROR: syntax error at or near ")" LINE 1: select decode('ygAAA', 'base64'); …
yelan_fn
  • 41
  • 1
  • 3
3
votes
1 answer

How to get data out of a postgres bytea column into a python variable using sqlalchemy?

I am working with the script below. If I change the script so I avoid the bytea datatype, I can easily copy data from my postgres table into a python variable. But if the data is in a bytea postgres column, I encounter a strange object called memory…
user3676943
  • 913
  • 1
  • 13
  • 27
3
votes
1 answer

How to download bytea column as file using Java

I want to download files stored in bytea format using java. I don't have superuser privileges. Using the code below I download the hex encoded file and convert it to pdf but the converted pdf is damaged whereas if I copy using \copy function(cannot…
sourabh
  • 43
  • 2
  • 5
3
votes
1 answer

How do I insert a JPEG image into a PostgreSQL bytea field using Java and then display on a website using PHP?

I made a little Java program that reads image files (jpg/jpeg) and inserts them into a database table covers.cover, which is of type bytea. I'm fairly certain that the byte[] cover parameter that is passed to the Java addCover(int riddim_id, byte[]…
phew
  • 808
  • 1
  • 15
  • 34
3
votes
1 answer

Golang+Postgres WHERE clause with a hex value

I created a simple sql database with a BYTEA field, create table testhex (testhex bytea); insert into testhex (testhex) values ('\x123456'); and then I tried to query it from Go. package main import ( "database/sql" _…
Nick Retallack
  • 18,986
  • 17
  • 92
  • 114
1
2
3
12 13