Discussion:
Problem with lo_export() and lo_import() from remote machine.
Purusothaman A
2006-09-09 11:07:24 UTC
Permalink
Hi all,

I have problem while using "lo_export()" and "lo_import()" from remote
system.

eg:
****
select lo_export(img_file, 'E:\\temp\\1001.jpg') from master where emp_id =
'1001';
insert into master(img_file) values(lo_import('E:\\temp\\1001.jpg')) where
emp_id = '1001';

Here column "img_file" is OID data type.

The above query works, if I enter from PostgreSQL server machine.
But the same query fails, if I enter from any other client machine in my
LAN.

All other queries work well from remote machine, which do not deal OID data
type column.

any suggestions would be appreciated.

:)
Purusothaman A
Milen A. Radev
2006-09-09 11:34:03 UTC
Permalink
Post by Purusothaman A
Hi all,
I have problem while using "lo_export()" and "lo_import()" from remote
system.
****
select lo_export(img_file, 'E:\\temp\\1001.jpg') from master where emp_id =
'1001';
insert into master(img_file) values(lo_import('E:\\temp\\1001.jpg')) where
emp_id = '1001';
Here column "img_file" is OID data type.
The above query works, if I enter from PostgreSQL server machine.
But the same query fails, if I enter from any other client machine in my
LAN.
All other queries work well from remote machine, which do not deal OID data
type column.
any suggestions would be appreciated.
Please, RTFM - http://www.postgresql.org/docs/current/static/lo-funcs.html

Quote:

"The server-side lo_import and lo_export functions behave considerably
differently from their client-side analogs. These two functions read and
write files in the server's file system, using the permissions of the
database's owning user. Therefore, their use is restricted to
superusers. In contrast, the client-side import and export functions
read and write files in the client's file system, using the permissions
of the client program. The client-side functions can be used by any
PostgreSQL user."
--
Milen A. Radev


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Purusothaman A
2006-09-09 11:49:26 UTC
Permalink
Hi Milen A. Radev,

Thank you for your response.

I have read this in PostgreSQL documentation.

I usually log in to postgresql server with admin username.

But whatever its, according to documentation, if client machine's user has
write access
permission, this query should successfully be executed.

Both PostgreSQL server/client are Windows XP machines.

Any suggestion???

:)
Purusothaman A
Post by Purusothaman A
Post by Purusothaman A
Hi all,
I have problem while using "lo_export()" and "lo_import()" from remote
system.
****
select lo_export(img_file, 'E:\\temp\\1001.jpg') from master where
emp_id =
Post by Purusothaman A
'1001';
insert into master(img_file) values(lo_import('E:\\temp\\1001.jpg'))
where
Post by Purusothaman A
emp_id = '1001';
Here column "img_file" is OID data type.
The above query works, if I enter from PostgreSQL server machine.
But the same query fails, if I enter from any other client machine in my
LAN.
All other queries work well from remote machine, which do not deal OID
data
Post by Purusothaman A
type column.
any suggestions would be appreciated.
Please, RTFM - http://www.postgresql.org/docs/current/static/lo-funcs.html
"The server-side lo_import and lo_export functions behave considerably
differently from their client-side analogs. These two functions read and
write files in the server's file system, using the permissions of the
database's owning user. Therefore, their use is restricted to
superusers. In contrast, the client-side import and export functions
read and write files in the client's file system, using the permissions
of the client program. The client-side functions can be used by any
PostgreSQL user."
--
Milen A. Radev
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Martijn van Oosterhout
2006-09-09 12:06:13 UTC
Permalink
Post by Purusothaman A
I usually log in to postgresql server with admin username.
But whatever its, according to documentation, if client machine's user has
write access
permission, this query should successfully be executed.
Read carefully, you are using the server-side functions, therefore:

"These two functions read and write files in the server's file system,
using the permissions of the database's owning user."

What your client user is is irrelevent. Perhaps you actually want to
use the client-side functions?

Have a nice day,
--
Post by Purusothaman A
From each according to his ability. To each according to his ability to litigate.
Purusothaman A
2006-09-11 09:15:10 UTC
Permalink
Hi Martijn van Oosterhout,

Thanks for your valuable reply.

Yes I misunderstood the documentation.

Then, I searched PostgreSQL documentation for equivalent client-side
functions.
But I found only C programming APIs instead of SQL functions.

I want functions which is usable in SQL statements.

Can you give example or equivalent client side function syntax?

Thanks in advance.

:)
Purusothaman A
Post by Martijn van Oosterhout
Post by Purusothaman A
I usually log in to postgresql server with admin username.
But whatever its, according to documentation, if client machine's user
has
Post by Purusothaman A
write access
permission, this query should successfully be executed.
"These two functions read and write files in the server's file system,
using the permissions of the database's owning user."
What your client user is is irrelevent. Perhaps you actually want to
use the client-side functions?
Have a nice day,
--
Post by Purusothaman A
From each according to his ability. To each according to his ability to
litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFAq41IB7bNG8LQkwRAsptAKCDSWuRI5T+JMqpWEQt7r69kJE6CwCfVTOO
mOqGDNQBTZZDs4WVf6NM+wQ=
=kT4s
-----END PGP SIGNATURE-----
Martijn van Oosterhout
2006-09-11 09:38:19 UTC
Permalink
Short answer, you can't. The database server can obviously only access
things on the database server. Since SQL is also executed on the
server, no SQL statements can access stuff on the client computer.

If you want to load a file on the client side to the server, you need
to open the file and copy it over using the lo_ functions. There no way
(IIRC) to access the contents of large objects from just SQL.

Hope this helps,
Post by Purusothaman A
Hi Martijn van Oosterhout,
Thanks for your valuable reply.
Yes I misunderstood the documentation.
Then, I searched PostgreSQL documentation for equivalent client-side
functions.
But I found only C programming APIs instead of SQL functions.
I want functions which is usable in SQL statements.
Can you give example or equivalent client side function syntax?
Thanks in advance.
:)
Purusothaman A
Post by Martijn van Oosterhout
Post by Purusothaman A
I usually log in to postgresql server with admin username.
But whatever its, according to documentation, if client machine's user
has
Post by Purusothaman A
write access
permission, this query should successfully be executed.
"These two functions read and write files in the server's file system,
using the permissions of the database's owning user."
What your client user is is irrelevent. Perhaps you actually want to
use the client-side functions?
Have a nice day,
--
Post by Purusothaman A
From each according to his ability. To each according to his ability to
litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFAq41IB7bNG8LQkwRAsptAKCDSWuRI5T+JMqpWEQt7r69kJE6CwCfVTOO
mOqGDNQBTZZDs4WVf6NM+wQ=
=kT4s
-----END PGP SIGNATURE-----
--
Post by Purusothaman A
From each according to his ability. To each according to his ability to litigate.
Purusothaman A
2006-09-11 09:57:09 UTC
Permalink
Thanks Martijn van Oosterhout,

So, I have to write my own wrapper function upon the functions below.
1. Oid lo_import(PGconn *conn, const char *filename);
2. int lo_export(PGconn *conn, Oid lobjId, const char *filename);

Am I right?

:)
Purusothaman A
Post by Martijn van Oosterhout
Short answer, you can't. The database server can obviously only access
things on the database server. Since SQL is also executed on the
server, no SQL statements can access stuff on the client computer.
If you want to load a file on the client side to the server, you need
to open the file and copy it over using the lo_ functions. There no way
(IIRC) to access the contents of large objects from just SQL.
Hope this helps,
Post by Purusothaman A
Hi Martijn van Oosterhout,
Thanks for your valuable reply.
Yes I misunderstood the documentation.
Then, I searched PostgreSQL documentation for equivalent client-side
functions.
But I found only C programming APIs instead of SQL functions.
I want functions which is usable in SQL statements.
Can you give example or equivalent client side function syntax?
Thanks in advance.
:)
Purusothaman A
Post by Martijn van Oosterhout
Post by Purusothaman A
I usually log in to postgresql server with admin username.
But whatever its, according to documentation, if client machine's
user
Post by Purusothaman A
Post by Martijn van Oosterhout
has
Post by Purusothaman A
write access
permission, this query should successfully be executed.
"These two functions read and write files in the server's file system,
using the permissions of the database's owning user."
What your client user is is irrelevent. Perhaps you actually want to
use the client-side functions?
Have a nice day,
--
http://svana.org/kleptog/
Post by Purusothaman A
Post by Martijn van Oosterhout
Post by Purusothaman A
From each according to his ability. To each according to his ability
to
Post by Purusothaman A
Post by Martijn van Oosterhout
litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFAq41IB7bNG8LQkwRAsptAKCDSWuRI5T+JMqpWEQt7r69kJE6CwCfVTOO
mOqGDNQBTZZDs4WVf6NM+wQ=
=kT4s
-----END PGP SIGNATURE-----
--
Post by Purusothaman A
From each according to his ability. To each according to his ability to
litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFBS6LIB7bNG8LQkwRAvI6AJ9OW7cxZiJR0QsEsSOwkYHKkYDZ6gCbBrDA
GVPAoBeOhE+2toFa2zNbN3M=
=9W8I
-----END PGP SIGNATURE-----
Martijn van Oosterhout
2006-09-11 10:03:36 UTC
Permalink
Post by Purusothaman A
Thanks Martijn van Oosterhout,
So, I have to write my own wrapper function upon the functions below.
1. Oid lo_import(PGconn *conn, const char *filename);
2. int lo_export(PGconn *conn, Oid lobjId, const char *filename);
Not sure why you need a wrapper (you didn't say which language you were
using) but those functions work exactly like the version you put in the
SQL statements, except the filenames are for the client computer with
client permissions.

Hope this helps,
--
Post by Purusothaman A
From each according to his ability. To each according to his ability to litigate.
Purusothaman A
2006-09-11 10:15:26 UTC
Permalink
Thanks Martijn van Oosterhout and Marco Bizzarri.

But, according to syntax of client side lo_import and lo_export, we should
have 2 variable PGconn (for esatablished connection) and lobjld (imported
file ID in PostgreSQL).

I don't know how to do this in SQL statements.

pls give me sample client side sql statements.

:)
Purusothaman A
Post by Martijn van Oosterhout
Post by Purusothaman A
Thanks Martijn van Oosterhout,
So, I have to write my own wrapper function upon the functions below.
1. Oid lo_import(PGconn *conn, const char *filename);
2. int lo_export(PGconn *conn, Oid lobjId, const char *filename);
Not sure why you need a wrapper (you didn't say which language you were
using) but those functions work exactly like the version you put in the
SQL statements, except the filenames are for the client computer with
client permissions.
Hope this helps,
--
Post by Purusothaman A
From each according to his ability. To each according to his ability to
litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFBTR4IB7bNG8LQkwRAvhPAJ9KHp9DO1EjPqbkGwBdaSaKx5J90wCfQtZ8
ijq1n/SgAlwIiEgDI6zfICg=
=Xk7N
-----END PGP SIGNATURE-----
Marco Bizzarri
2006-09-11 10:56:11 UTC
Permalink
I will try to explain it with a sample session: this is for creating
and writing a blob.
From the psql prompt (> are the commands, the other are the results).
begin ;
BEGIN;
SELECT lo_creat(131072) ;
lo_creat
----------
198705
(1 row)
(this is the OID number of the newly created large object).
select lo_open(198705, 131072) ;
lo_open
---------
0
(1 row)

(this is the file handler which you will use in the operations).
SELECT lowrite(0, 'aaaa');
lowrite
---------
4
(1 row)

(you wrote 4 character in a large object)
select lo_close(0);
lo_close
----------
0
(1 row)

(you closed the file).
commit ;
COMMIT

In this way, you created a new large object, and stored a string of 4
bytes inside of it.

Regards
Marco
Thanks Martijn van Oosterhout and Marco Bizzarri.
But, according to syntax of client side lo_import and lo_export, we should
have 2 variable PGconn (for esatablished connection) and lobjld (imported
file ID in PostgreSQL).
I don't know how to do this in SQL statements.
pls give me sample client side sql statements.
:)
Purusothaman A
Post by Purusothaman A
Thanks Martijn van Oosterhout,
So, I have to write my own wrapper function upon the functions below.
1. Oid lo_import(PGconn *conn, const char *filename);
2. int lo_export(PGconn *conn, Oid lobjId, const char *filename);
Not sure why you need a wrapper (you didn't say which language you were
using) but those functions work exactly like the version you put in the
SQL statements, except the filenames are for the client computer with
client permissions.
Hope this helps,
--
Post by Purusothaman A
From each according to his ability. To each according to his ability to
litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFBTR4IB7bNG8LQkwRAvhPAJ9KHp9DO1EjPqbkGwBdaSaKx5J90wCfQtZ8
ijq1n/SgAlwIiEgDI6zfICg=
=Xk7N
-----END PGP SIGNATURE-----
--
Marco Bizzarri
http://notenotturne.blogspot.com/

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org
Martijn van Oosterhout
2006-09-11 11:02:10 UTC
Permalink
Post by Marco Bizzarri
I will try to explain it with a sample session: this is for creating
and writing a blob.
Oh, I was looking for lo_read/lo_write, which don't exist. It's
loread/lowrite. Inconsonistant naming is irritating.

It doesn't help the OPs problem with lo_import/lo_export though.

Have a nice day,
--
Post by Marco Bizzarri
From each according to his ability. To each according to his ability to litigate.
Purusothaman A
2006-09-11 13:30:00 UTC
Permalink
Hi Marco Bizzarri and Martijn van Oosterhout,

Thanks for your valuable reply.

I am trying to execute all query from VC++ through
CDatabase::ExecuteSQL(sQueryString) function call.

ie, via programming, not by manual entering query statements.
so, in my situation I can construct a string and pass on to this function to
execute the query string.

Whatever the string I pass to ExecuteSQL() function, gets executed and I
cannot get any result retured from the passed query string [like OID -
198705, from lo_create()].

Now, can you suggest me how to achieve it?

And one more clarification, what is the value 131072? How can I get this
vlaue?

According to PostgreSQL documentation, they gave C Syntax as client side
function.

Should I use those C API calls?

:)
Purusothaman A
Post by Marco Bizzarri
I will try to explain it with a sample session: this is for creating
and writing a blob.
From the psql prompt (> are the commands, the other are the results).
begin ;
BEGIN;
SELECT lo_creat(131072) ;
lo_creat
----------
198705
(1 row)
(this is the OID number of the newly created large object).
select lo_open(198705, 131072) ;
lo_open
---------
0
(1 row)
(this is the file handler which you will use in the operations).
SELECT lowrite(0, 'aaaa');
lowrite
---------
4
(1 row)
(you wrote 4 character in a large object)
select lo_close(0);
lo_close
----------
0
(1 row)
(you closed the file).
commit ;
COMMIT
In this way, you created a new large object, and stored a string of 4
bytes inside of it.
Regards
Marco
Thanks Martijn van Oosterhout and Marco Bizzarri.
But, according to syntax of client side lo_import and lo_export, we
should
have 2 variable PGconn (for esatablished connection) and lobjld
(imported
file ID in PostgreSQL).
I don't know how to do this in SQL statements.
pls give me sample client side sql statements.
:)
Purusothaman A
Post by Purusothaman A
Thanks Martijn van Oosterhout,
So, I have to write my own wrapper function upon the functions below.
1. Oid lo_import(PGconn *conn, const char *filename);
2. int lo_export(PGconn *conn, Oid lobjId, const char *filename);
Not sure why you need a wrapper (you didn't say which language you were
using) but those functions work exactly like the version you put in the
SQL statements, except the filenames are for the client computer with
client permissions.
Hope this helps,
--
Post by Purusothaman A
From each according to his ability. To each according to his ability
to
litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFBTR4IB7bNG8LQkwRAvhPAJ9KHp9DO1EjPqbkGwBdaSaKx5J90wCfQtZ8
ijq1n/SgAlwIiEgDI6zfICg=
=Xk7N
-----END PGP SIGNATURE-----
--
Marco Bizzarri
http://notenotturne.blogspot.com/
Marco Bizzarri
2006-09-11 14:49:37 UTC
Permalink
Post by Purusothaman A
Hi Marco Bizzarri and Martijn van Oosterhout,
Thanks for your valuable reply.
I am trying to execute all query from VC++ through
CDatabase::ExecuteSQL(sQueryString) function call.
ie, via programming, not by manual entering query statements.
so, in my situation I can construct a string and pass on to this function to
execute the query string.
Whatever the string I pass to ExecuteSQL() function, gets executed and I
cannot get any result retured from the passed query string [like OID -
198705, from lo_create()].
I'm not an expert in VC++. I think you should obtain some sort of
ResultSet object. You could then check that.
Post by Purusothaman A
Now, can you suggest me how to achieve it?
And one more clarification, what is the value 131072? How can I get this
vlaue?
This is actually 0x20000 value in decimal. Check large object
interface in postgresql documentation (C API).
Post by Purusothaman A
According to PostgreSQL documentation, they gave C Syntax as client side
function.
Should I use those C API calls?
If you're working from inside C, you can check:

http://www.postgresql.org/docs/8.1/static/lo-interfaces.html

Regards
Marco
Post by Purusothaman A
:)
Purusothaman A
Post by Marco Bizzarri
I will try to explain it with a sample session: this is for creating
and writing a blob.
From the psql prompt (> are the commands, the other are the results).
begin ;
BEGIN;
SELECT lo_creat(131072) ;
lo_creat
----------
198705
(1 row)
(this is the OID number of the newly created large object).
select lo_open(198705, 131072) ;
lo_open
---------
0
(1 row)
(this is the file handler which you will use in the operations).
SELECT lowrite(0, 'aaaa');
lowrite
---------
4
(1 row)
(you wrote 4 character in a large object)
select lo_close(0);
lo_close
----------
0
(1 row)
(you closed the file).
commit ;
COMMIT
In this way, you created a new large object, and stored a string of 4
bytes inside of it.
Regards
Marco
Thanks Martijn van Oosterhout and Marco Bizzarri.
But, according to syntax of client side lo_import and lo_export, we
should
Post by Marco Bizzarri
have 2 variable PGconn (for esatablished connection) and lobjld
(imported
Post by Marco Bizzarri
file ID in PostgreSQL).
I don't know how to do this in SQL statements.
pls give me sample client side sql statements.
:)
Purusothaman A
Post by Purusothaman A
Thanks Martijn van Oosterhout,
So, I have to write my own wrapper function upon the functions below.
1. Oid lo_import(PGconn *conn, const char *filename);
2. int lo_export(PGconn *conn, Oid lobjId, const char *filename);
Not sure why you need a wrapper (you didn't say which language you were
using) but those functions work exactly like the version you put in the
SQL statements, except the filenames are for the client computer with
client permissions.
Hope this helps,
--
Post by Purusothaman A
From each according to his ability. To each according to his ability
to
Post by Marco Bizzarri
litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFBTR4IB7bNG8LQkwRAvhPAJ9KHp9DO1EjPqbkGwBdaSaKx5J90wCfQtZ8
Post by Marco Bizzarri
ijq1n/SgAlwIiEgDI6zfICg=
=Xk7N
-----END PGP SIGNATURE-----
--
Marco Bizzarri
http://notenotturne.blogspot.com/
--
Marco Bizzarri
http://notenotturne.blogspot.com/

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
Purusothaman A
2006-09-12 10:34:07 UTC
Permalink
Thank you Marco Bizzarri.

My solution would be C API.

Thanks for you prompt response.

:)
Purusothaman A
Post by Purusothaman A
Post by Purusothaman A
Hi Marco Bizzarri and Martijn van Oosterhout,
Thanks for your valuable reply.
I am trying to execute all query from VC++ through
CDatabase::ExecuteSQL(sQueryString) function call.
ie, via programming, not by manual entering query statements.
so, in my situation I can construct a string and pass on to this
function to
Post by Purusothaman A
execute the query string.
Whatever the string I pass to ExecuteSQL() function, gets executed and I
cannot get any result retured from the passed query string [like OID -
198705, from lo_create()].
I'm not an expert in VC++. I think you should obtain some sort of
ResultSet object. You could then check that.
Post by Purusothaman A
Now, can you suggest me how to achieve it?
And one more clarification, what is the value 131072? How can I get this
vlaue?
This is actually 0x20000 value in decimal. Check large object
interface in postgresql documentation (C API).
Post by Purusothaman A
According to PostgreSQL documentation, they gave C Syntax as client side
function.
Should I use those C API calls?
http://www.postgresql.org/docs/8.1/staticI /lo-interfaces.html
Regards
Marco
Post by Purusothaman A
:)
Purusothaman A
Post by Marco Bizzarri
I will try to explain it with a sample session: this is for creating
and writing a blob.
From the psql prompt (> are the commands, the other are the results).
begin ;
BEGIN;
SELECT lo_creat(131072) ;
lo_creat
----------
198705
(1 row)
(this is the OID number of the newly created large object).
select lo_open(198705, 131072) ;
lo_open
---------
0
(1 row)
(this is the file handler which you will use in the operations).
SELECT lowrite(0, 'aaaa');
lowrite
---------
4
(1 row)
(you wrote 4 character in a large object)
select lo_close(0);
lo_close
----------
0
(1 row)
(you closed the file).
commit ;
COMMIT
In this way, you created a new large object, and stored a string of 4
bytes inside of it.
Regards
Marco
Thanks Martijn van Oosterhout and Marco Bizzarri.
But, according to syntax of client side lo_import and lo_export, we
should
Post by Marco Bizzarri
have 2 variable PGconn (for esatablished connection) and lobjld
(imported
Post by Marco Bizzarri
file ID in PostgreSQL).
I don't know how to do this in SQL statements.
pls give me sample client side sql statements.
:)
Purusothaman A
Post by Purusothaman A
Thanks Martijn van Oosterhout,
So, I have to write my own wrapper function upon the functions
below.
Post by Purusothaman A
Post by Marco Bizzarri
Post by Purusothaman A
1. Oid lo_import(PGconn *conn, const char *filename);
2. int lo_export(PGconn *conn, Oid lobjId, const char
*filename);
Post by Purusothaman A
Post by Marco Bizzarri
Not sure why you need a wrapper (you didn't say which language you
were
Post by Purusothaman A
Post by Marco Bizzarri
using) but those functions work exactly like the version you put in
the
Post by Purusothaman A
Post by Marco Bizzarri
SQL statements, except the filenames are for the client computer
with
Post by Purusothaman A
Post by Marco Bizzarri
client permissions.
Hope this helps,
--
http://svana.org/kleptog/
Post by Purusothaman A
Post by Marco Bizzarri
Post by Purusothaman A
From each according to his ability. To each according to his
ability
Post by Purusothaman A
to
Post by Marco Bizzarri
litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFBTR4IB7bNG8LQkwRAvhPAJ9KHp9DO1EjPqbkGwBdaSaKx5J90wCfQtZ8
Post by Marco Bizzarri
ijq1n/SgAlwIiEgDI6zfICg=
=Xk7N
-----END PGP SIGNATURE-----
--
Marco Bizzarri
http://notenotturne.blogspot.com/
--
Marco Bizzarri
http://notenotturne.blogspot.com/
Marco Bizzarri
2006-09-11 10:07:06 UTC
Permalink
Actually, you can use direclty the lo_create, lo_open, lo_read and
lo_write directly into your SQL code, instead of having to write a
wrapper function. It is not simple, but it can be done.

I don't have a general example: we have done this in a couple of our
projects, one being public availabe (www.paflow.it): look in the
Documents.py source, and look for the lo_xxx queries.

This is indipendent from the fact that client and server are running
on the same server.

Regards
Marco
Post by Purusothaman A
Thanks Martijn van Oosterhout,
So, I have to write my own wrapper function upon the functions below.
1. Oid lo_import(PGconn *conn, const char *filename);
2. int lo_export(PGconn *conn, Oid lobjId, const char *filename);
Am I right?
:)
Purusothaman A
Short answer, you can't. The database server can obviously only access
things on the database server. Since SQL is also executed on the
server, no SQL statements can access stuff on the client computer.
If you want to load a file on the client side to the server, you need
to open the file and copy it over using the lo_ functions. There no way
(IIRC) to access the contents of large objects from just SQL.
Hope this helps,
Post by Purusothaman A
Hi Martijn van Oosterhout,
Thanks for your valuable reply.
Yes I misunderstood the documentation.
Then, I searched PostgreSQL documentation for equivalent client-side
functions.
But I found only C programming APIs instead of SQL functions.
I want functions which is usable in SQL statements.
Can you give example or equivalent client side function syntax?
Thanks in advance.
:)
Purusothaman A
Post by Martijn van Oosterhout
Post by Purusothaman A
I usually log in to postgresql server with admin username.
But whatever its, according to documentation, if client machine's user
has
Post by Purusothaman A
write access
permission, this query should successfully be executed.
"These two functions read and write files in the server's file system,
using the permissions of the database's owning user."
What your client user is is irrelevent. Perhaps you actually want to
use the client-side functions?
Have a nice day,
--
Post by Purusothaman A
From each according to his ability. To each according to his ability to
litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFAq41IB7bNG8LQkwRAsptAKCDSWuRI5T+JMqpWEQt7r69kJE6CwCfVTOO
Post by Martijn van Oosterhout
mOqGDNQBTZZDs4WVf6NM+wQ=
=kT4s
-----END PGP SIGNATURE-----
--
Post by Purusothaman A
From each according to his ability. To each according to his ability to
litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFBS6LIB7bNG8LQkwRAvI6AJ9OW7cxZiJR0QsEsSOwkYHKkYDZ6gCbBrDA
GVPAoBeOhE+2toFa2zNbN3M=
=9W8I
-----END PGP SIGNATURE-----
--
Marco Bizzarri
http://notenotturne.blogspot.com/

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ***@postgresql.org so that your
message can get through to the mailing list cleanly
Continue reading on narkive:
Loading...