Re: BLOBS - Mailing list pgsql-interfaces
From | Compte utilisateur Sultan-advl |
---|---|
Subject | Re: BLOBS |
Date | |
Msg-id | 00020523334702.00886@sultan Whole thread Raw |
List | pgsql-interfaces |
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/
pgsql-interfaces by date: