You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to write R object to Postgres large object #376
But then I have a hard time figuring out how to write an R object to this large object.
For example, how would I write mtcars as a large object in Postgres using {DBI} and {RPostgres}?
df <- DBI::dbGetQuery(conn, "select lo_get(1234) as image")
But those functions only work on the server side, i.e., the file must be on the same server as PostgreSQL. Also, the user must be a superuser. It would be great if someone built an R package to work on the client side: client interfaces.
Added a PR that introduces the postgresImportLargeObject() for importing large objects from client side. I used libpq's lo_import_with_oid() so you can import to a specific oid if need be.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.
Activity
krlmlr commentedon Dec 20, 2021
Thanks. Can you use
lo_from_bytea(),lo_put()andlo_get(), perhaps withdbQuoteLiteral()to quote a blob value?jjesusfilho commentedon Jan 16, 2023
I use
lo_import()to insert images as blobs in PostgreSQL:In order to bring the image to R, I use
lo_get():But those functions only work on the server side, i.e., the file must be on the same server as PostgreSQL. Also, the user must be a superuser. It would be great if someone built an R package to work on the client side: client interfaces.
krlmlr commentedon Apr 1, 2024
There is a libpq function
lo_import()that accepts files on the client system. Does the R interface need to do more than calling this function?toppyy commentedon Oct 19, 2024
Added a PR that introduces the
postgresImportLargeObject()for importing large objects from client side. I used libpq'slo_import_with_oid()so you can import to a specific oid if need be.github-actions commentedon Feb 25, 2026
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.