lo_import problem

From: Michael Meskes <meskes(at)usa(dot)net>
To: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: lo_import problem
Date: 1998-11-13 10:32:38
Message-ID: 19981113113238.A1920@usa.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've just been send the following problem report:

> >1. To store the data file I am using lo_import function of large
> >object interface. As I am storing(importing into database) the file
> >even 100 bytes only. During the importing process it creates two files
> >into the database area xinv*,xinx* .I don't know why it is taking the
> >space of 16384 Bytes for each xinv* xinx* file in the database.
> > This much space consumption is unmanageable. Please help me.
> >Actually how this import the file I don't know.
> >Thanks alot
> ...

I am sending a sample source code.
1 #include <stdio.h>
2 #include "libpq-fe.h"
3 #include <stdlib.h>
4 char shotno[10];
5 main()
6 {
7 char filename[35];
8 char *pghost,*pgport,*pgoptions,*pgtty,query2[100];
9 char *dbName, shotno[10];
10 PGconn *conn;
11 PGresult *res2;
12 int shot,gchno;
13 pghost = "sun9"; /* host name of the backend server */
14 pgport = "5432"; /* port of the backend server */
15 pgoptions = NULL; /* special options to start up the backend */
16 pgtty = NULL; /* debugging tty for the backend server */
17 dbName = "aditya";
18 /* make a connection to the database */
19 conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);
20 /* check to see that the backend connection was successfully made */
21 if (PQstatus(conn) == CONNECTION_BAD)
22 {
23 fprintf(stderr,"Connection to database '%s' failed.\n", dbName);
24 fprintf(stderr,"%s", PQerrorMessage(conn));
25 exit(0);
26 }
27 printf("\nEnter the shot no... ");
28 scanf("%s",shotno);
29 shot=atoi(shotno);
30 gchno=200;
31 filename="/users13/aditya/vax/a05966.lgg";
32 sprintf(query2,"insert into ch_data values ( %d ,%d , lo_import('%s')) ; " , shot ,gchno , filename);
33 res2 = PQexec(conn,query2);
34 }
35 printf("\n The Data File For This Shot has transferred 'OK' \n");
36 }
--
In this code the file I am importing "/users13/aditya/vax/a05966.lgg"
has a size of 3328 bytes only. This file consumes the space in database
is of 2*16384 bytes. It creates two files xinv* and xinx* in database of
size 16384 bytes each.

sun9:/work/postgres/local/data/base/aditya>$ ls -laF
-rw------- 1 postgres guest 16384 Nov 12 10:37 xinx154230
-rw------- 1 postgres guest 16384 Nov 12 10:37 xinv154230
How can I reduce the size of the file in database.
H.K.Gulati hkg(at)plasma(dot)ernet(dot)in
Engineer - SC
Institute For Plasma Research
Bhat Gandhinagar(GUJARAT)

Michael

--
Dr. Michael Meskes, Manager of the Western Branch Office, Datenrevision GmbH
work: Cuxhavener Str. 36, D-21149 Hamburg
home: Th.-Heuss-Str. 61, D-41812 Erkelenz, Michael(dot)Meskes(at)usa(dot)net
Go SF49ers! Go Rhein Fire! Use Debian GNU/Linux!

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-11-13 10:50:34 Re: [HACKERS] CASE construct
Previous Message Zsolt Varga 1998-11-13 08:29:47 still Query Limits to 8K ?