keeping images in a bytea field on AWS RDS
keeping images in a bytea field on AWS RDS
От:
Richard Bernstein <richb201@gmail.com>
Дата:
I am using postgresql on RDS. I need to upload an image to the table. I understand that I need to set the PGDATA directory and place the image file in it, before setting the path in the bytea field. But how do I set PGDATA if I don't have the ability to set an environment variable, and don't have access to the following on an AWS controlled installation?
$ initdb -D /usr/local/pgsql/data or
pg_ctl -D /usr/local/pgsql/data initdb
Re: keeping images in a bytea field on AWS RDS
От:
Christophe Pettus <xof@thebuild.com>
Дата:
> On Mar 31, 2020, at 12:49, Richard Bernstein wrote: > > I am using postgresql on RDS. I need to upload an image to the table. I understand that I need to set the PGDATA directory and place the image file in it, before setting the path in the bytea field. But how do I set PGDATA if I don't have the ability to set an environment variable, and don't have access to the following on an AWS controlled installation? No, that's not how you upload images to a bytea field; you use the standard client library and send the bytea data over that way. It works the same on community PostgreSQL and RDS. PostgreSQL handles managing the bytea data for you. Note that for very large binary objects, storing them in the database is not going to be very efficient versus keeping them in the filesystem (noting, of course, that you don't have access to the filesystem of an RDS server). -- -- Christophe Pettus xof@thebuild.com
Re: keeping images in a bytea field on AWS RDS
От:
Alan Hodgson <ahodgson@lists.simkin.ca>
Дата:
On Tue, 2020-03-31 at 15:49 -0400, Richard Bernstein wrote:
I am using postgresql on RDS. I need to upload an image to the table. I understand that I need to set the PGDATA directory and place the image file in it, before setting the path in the bytea field. But how do I set PGDATA if I don't have the ability to set an environment variable, and don't have access to the following on an AWS controlled installation?
You don't put a file path into a bytea field or do anything with the database filesystem. You insert the contents of the actual file into the field using SQL commands.
Re: keeping images in a bytea field on AWS RDS
От:
Ron <ronljohnsonjr@gmail.com>
Дата:
On 3/31/20 2:49 PM, Richard Bernstein wrote:
initdb is definitely not what you want to do just to load an image into an exiting database.
I am using postgresql on RDS. I need to upload an image to the table. I understand that I need to set the PGDATA directory and place the image file in it, before setting the path in the bytea field. But how do I set PGDATA if I don't have the ability to set an environment variable, and don't have access to the following on an AWS controlled installation?$ initdb -D /usr/local/pgsql/data
orpg_ctl -D /usr/local/pgsql/data initdb
initdb is definitely not what you want to do just to load an image into an exiting database.
--
Angular momentum makes the world go 'round.
Angular momentum makes the world go 'round.
Re: keeping images in a bytea field on AWS RDS
От:
Christophe Pettus <xof@thebuild.com>
Дата:
> On Mar 31, 2020, at 13:52, Ron wrote: > initdb is definitely not what you want to do just to load an image into an exiting database. I think there may be some confusion on the OP's part because many sources give out *advice* to put a filesystem path, rather than the entire actual binary object, into the database... and that's still good advice, even on RDS! It just means that path needs to be a URI or some other piece of metadata that points to a different server, rather than the RDS server. -- -- Christophe Pettus xof@thebuild.com