pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Compte utilisateur Sultan-advl <webmaster@advl.org>
To: Ray Alba <ralba@electric-web.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: BLOBS
Date: Sat, 5 Feb 2000 23:13:45 +0100
Message-ID: <00020523334702.00886@sultan> (raw)
References: <v03007801b4c1f07fd1e0@[192.168.0.1]>

Re,
Thinking your create table is off. Sorry for my poor english but try &
practice with this :

Under postgresql user :
psql yourDb

A)
-- ++++++++++++++++++++++++++++++++++
-- CREATION OF TYPE : LO
-- ++++++++++++++++++++++++++++++++++

create type lo ( 
        internallength=4,
        externallength=10, 
        input=int4in,
        output=int4out, 
        default='',
        passedbyvalue 
        );

B) CREATE TABLE ; INSERT BLOB ; SELECT BLOB
IN THIS CASE THE BLOB IS FILE /ETC /FSTAB : SELECT EXPORT THE BLOB IN
/TMP/TOTOFSTAB

CREATE TABLE image (name text, raster oid);
INSERT INTO image (name, raster) VALUES ('toto',lo_import('/etc/fstab'));
SELECT lo_export(image.raster, '/tmp/totofstab') from image WHERE name = 'toto';

C) under your term
more /tmp/totofstab : you'll see your fstab (under Unix like)
==
In my case that works ... and it's on Documentation ;-)
Hope that's help.
Regards.
Emmanuel
===================


Le sam, 05 fév 2000, vous avez écrit :
> I am also trying to store word files and images in my postgres database and
> for some reason my create table is giving an error;;
> 
> Here is the syntax to create the table:
> 
> CREATE TABLE binary_data (id INT4 NOT NULL PRIMARY KEY,client_id
> varchar(50), project_id varchar(50), description CHAR(50), bin_data
> BLOB,filename CHAR(50),filesize CHAR(50),filetype CHAR(50));
> 
> 
> and here is the error
> 
> type name lookup of blob failed
> 
> How do you assign a blob to a table? Can you tell me what I am doing wrong?
> 
> Thanks,
> 
> Ray
> 
> 
> ----------  Message réacheminé  ----------
> Subject: Re: [SQL] Blobs
> Date: Mon, 24 Jan 2000 17:07:05 +0100
> From: Compte utilisateur Sultan-advl <webmaster@advl.org>
> 
> 
> You can find this in Postgresql documentation :
> PostgreSQL
> Prev
> Chapter 44. Large Objects
> Built in registered functions
> There are two built-in registered functions, lo_import and lo_export which
> are convenient for use in SQL queries.
> Here is an example of their use
> 
> CREATE TABLE image (
>     name            text,
>     raster          oid
> );
> 
> INSERT INTO image (name, raster)
>     VALUES ('beautiful image', lo_import('/etc/motd'));
> 
> SELECT lo_export(image.raster, "/tmp/motd") from image
>     WHERE name = 'beautiful image';
> 
> Regards.
> Emmanuel.
> 
> 
> Le lun, 24 jan 2000, vous avez écrit :
> > >%_Hi Folks
> >
> > I want to store Word docs etc into the mighty Postgres. I think this
> >means using blobs.
> >
> > 1.Does anybody know the SQL to create say a table with a field called
> >docs to store them in. I don't know what the data type is.
> >
> >     ie something like CREATE TABLE documents docs (blob datatype ??)
> >
> > 2. Is there some special syntax to get the blob back. ie SELECT (special
> >syntax)
> >
> > Thanks
> >
> > Neil@blueice
> >
> 
>     ---------------------------------
>     *  Ray Alba/ Electric Web       *
>     *     55 West 92nd Street       *
>     *         212.353.7788          *
>     *   ralba@electric-web.com      *
>     ---------------------------------
--

Emmanuel DISCORS
http://www.advl.org/




Message-ID: <00020523334702.00886@sultan>
Permalink:  ../00020523334702.00886@sultan/
Also on:    postgresql.org/message-id/00020523334702.00886@sultan

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: webmaster@advl.org, ralba@electric-web.com
  Subject: Re: BLOBS
  In-Reply-To: <00020523334702.00886@sultan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox