X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 6A8F69FB2A1 for ; Mon, 11 Sep 2006 07:07:39 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 31709-01 for ; Mon, 11 Sep 2006 10:07:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.177]) by postgresql.org (Postfix) with ESMTP id 795ED9FB2A7 for ; Mon, 11 Sep 2006 07:07:08 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so2108624pyd for ; Mon, 11 Sep 2006 03:07:07 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DHxSxemmMNTBTF1dv7iqGlwciKMxI/8d/tCnPp7UdrIaAw0q6a9gBGyy6We45AQmGAwUJ3GOBEF+g8sfdC63vL6R+x43jvzurCTchANb/0khhGr1KTgkYf9cYEWeAI3yAdLn80osyBHPVNjcRWET/IjDpvzvlexZntm3+cfQWYE= Received: by 10.35.72.6 with SMTP id z6mr8529471pyk; Mon, 11 Sep 2006 03:07:06 -0700 (PDT) Received: by 10.35.113.10 with HTTP; Mon, 11 Sep 2006 03:07:06 -0700 (PDT) Message-ID: <3f0d61c40609110307k62ecfc58w93b4e82fb8d8019@mail.gmail.com> Date: Mon, 11 Sep 2006 12:07:06 +0200 From: "Marco Bizzarri" To: "Purusothaman A" Subject: Re: [GENERAL] Problem with lo_export() and lo_import() from remote machine. Cc: "Martijn van Oosterhout" , "Milen A. Radev" , pgsql-admin@postgresql.org, pgsql-general@postgresql.org In-Reply-To: <3650d0d50609110257m7b216b27nabb8ae87f7852e2@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3650d0d50609090407j237bb710h9bde1675c773925d@mail.gmail.com> <3650d0d50609090449q2aec1098xc3b62dd169de5843@mail.gmail.com> <20060909120613.GA10336@svana.org> <3650d0d50609110215j7361bc2dj55e6d7d73af1d07d@mail.gmail.com> <20060911093819.GA15769@svana.org> <3650d0d50609110257m7b216b27nabb8ae87f7852e2@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200609/85 X-Sequence-Number: 22999 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 On 9/11/06, Purusothaman A wrote: > 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 > > > On 9/11/06, Martijn van Oosterhout wrote: > > > 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, > > On Mon, Sep 11, 2006 at 02:45:10PM +0530, Purusothaman A wrote: > > 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 > > > > > > > > > > On 9/9/06, Martijn van Oosterhout wrote: > > > > > >On Sat, Sep 09, 2006 at 05:19:26PM +0530, Purusothaman A wrote: > > >> 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, > > >-- > > >Martijn van Oosterhout http://svana.org/kleptog/ > > >> 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 http://svana.org/kleptog/ > > 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/