Thread: 2 Questions

2 Questions

From
Ramon Orticio
Date:
dear friends,

i'm using a laptop with redhat 9 OS.

1. how do you create or transfer to another location
postgres database aside from the initial
PGDATA=/var/lib/pgsql/data

2. how can a jpeg or bmp file be stored in postgres.

thanks for any idea.

merry christmas!

ramon






__________________________________________
Yahoo! DSL – Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com


Re: 2 Questions

From
Dario Brignardello
Date:
Hi, Ramon,

> 1. how do you create or transfer to another location
> postgres database aside from the initial
> PGDATA=/var/lib/pgsql/data

You must perform an initdb -D /path/to/new/data/directory
and then:
              a) set the PGDATA variable either in your shell
environment files (.bashrc, .bash_profile) or at the prompt with
'export PGDATA=/path/to/new/data/directory' or
             b) start the postmaster with the -D flag (-D /path/to/....)


> 2. how can a jpeg or bmp file be stored in postgres.
>
Using large objects, a long time have passed since I did that, you
should check the docs (
http://www.postgresql.org/docs/8.1/static/largeobjects.html ) ...
however, are you sure you want to do it that way ?


Hope it helps, feliz navidad ;-)

Best regards
Dario

--
Atte: Dario Brignardello

Re: 2 Questions

From
Devrim GUNDUZ
Date:
Hi,

On Thu, 22 Dec 2005, Ramon Orticio wrote:

> i'm using a laptop with redhat 9 OS.
>
> 1. how do you create or transfer to another location
> postgres database aside from the initial
> PGDATA=/var/lib/pgsql/data

I think you are using RPM installation.

So, first stop postmaster. Then move the initial data cluster to another
directory you wish. Edit /etc/init.d/postgresql and change all
/var/lib/pgsql/data to the new value. Then start PostgreSQL again.

> 2. how can a jpeg or bmp file be stored in postgres.

You need to use bytea data type for that:

http://www.postgresql.org/docs/current/static/datatype-binary.html
http://www.postgresql.org/docs/current/static/largeobjects.html

Regards,
--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

Re: 2 Questions

From
Date:
> 2. how can a jpeg or bmp file be stored in postgres.
>
> thanks for any idea.
>
> merry christmas!
>
> ramon

Ramon, one of my db functions is to display pdf files
- which can be considered similar to a picture.

i chose NOT to store the pdfs in my db.  rather, i
store a link to the pdf file.  i can't search my pdf
(i don't think i can, and if i could, it suspect it
would be a brutal process), but i can search for a
link to a pdf b/c i set up a naming convention.

for example, take part number 12345.

an_12345 = assembly note pdf
tn_12345 = test note pdf

i use php to search for the p/n input by the user and
i can append the standard nomenclature in order to
search for all the relevant pdf files (pictures).

you may want to consider doing something similar or
modifying the technique to suit your purposes.

good luck.



__________________________________________
Yahoo! DSL – Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com


Re: 2 Questions

From
Date:
> > 2. how can a jpeg or bmp file be stored in
> postgres.
> >
> > thanks for any idea.
> >
> > merry christmas!
> >
> > ramon
>
> Ramon, one of my db functions is to display pdf
> files
> - which can be considered similar to a picture.
>
> i chose NOT to store the pdfs in my db.  rather, i
> store a link to the pdf file.  i can't search my pdf
> (i don't think i can, and if i could, it suspect it
> would be a brutal process), but i can search for a
> link to a pdf b/c i set up a naming convention.
>
> for example, take part number 12345.
>
> an_12345 = assembly note pdf
> tn_12345 = test note pdf
>
> i use php to search for the p/n input by the user
> and
> i can PREPEND the standard nomenclature in order to
> search for all the relevant pdf files (pictures).
>
> you may want to consider doing something similar or
> modifying the technique to suit your purposes.
>
> good luck.

oops, i meant prepend.




__________________________________
Yahoo! for Good - Make a difference this year.
http://brand.yahoo.com/cybergivingweek2005/

Re: 2 Questions

From
Ramon Orticio
Date:
dear friends,

thanks for your ideas and effort in sharing them.

merry christmas.

ramon




__________________________________
Yahoo! for Good - Make a difference this year.
http://brand.yahoo.com/cybergivingweek2005/