cancel
Showing results for 
Search instead for 
Did you mean: 

problems with writing / reading a data bytea

Silver Adventurer

Re: problems with writing / reading a data bytea

hi @dhananjayjejur, thanks for response 

the server with more memory:

 

              total        used        free      shared  buff/cache   available
Mem:          64265        1546         401       16767       62317       45404
Swap:          4095          15        4080

show shared_buffers 
16GB

show work_mem
64MB

show maintenance_work_mem
800MB

 

 

 

 

when i try to load video from python

#load_video.py
import psycopg2
conn_string = "host='localhost' dbname='testutf8' user='enterprisedb' password='rootroot' port=5444"
conn = psycopg2.connect(conn_string)


mi_video=open('/tmp/a2','rb').read()
cursor = conn.cursor()

###query = "INSERT INTO public.videos(id,dato) VALUES (%s,%s);" % (2, psycopg2.Binary(mi_video))
cursor.execute("INSERT INTO public.videos(id,dato) VALUES (%s,%s);", (2, psycopg2.Binary(mi_video)))
conn.commit()

###calling the script 
python load_video.py 
Traceback (most recent call last):
  File "load_video.py", line 11, in <module>
    cursor.execute("INSERT INTO public.videos(id,dato) VALUES (%s,%s);", (2, psycopg2.Binary(mi_video)))
psycopg2.OperationalError: out of memory
DETAIL:  Cannot enlarge string buffer containing 0 bytes by 1180388329 more bytes.

and when i try to load/unload with lo_import/lo_export

i got OK result 

 

bytea_import and lo_export_bfile are described in previous posts

 

insert into videos select 2, bytea_import ('/tmp/a2')

select public.lo_export_bfile (dato, '/tmp/video2') from videos where id=2

 

 

when i try to query :

 

select * from videos where id =2 ;
ERROR: invalid memory alloc request size 1180388273

whe i try to select other video of smaller size, works well

 

 

can you reproduce it?

Regards 

 

PD: i can share the video if you need it

 

Highlighted
EDB Team Member

Re: problems with writing / reading a data bytea

Hi astolongo,

 

It shows out of memory error here.

psycopg2.OperationalError: out of memory

It appears to be insufficient amount of free memory on the server to proceed data.

 

Thanks,

Ninad