Re: create a text file from postgres (like Oracle

From: Tino Wildenhain <tino(at)wildenhain(dot)de>
To: Leo Martin Orfei <orfeileo(at)yahoo(dot)com>
Cc: PgSql General <pgsql-general(at)postgresql(dot)org>
Subject: Re: create a text file from postgres (like Oracle
Date: 2004-11-06 14:10:35
Message-ID: 1099750235.15791.256.camel@Andrea.peacock.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Am Sa, den 06.11.2004 schrieb Leo Martin Orfei um 13:52:
> ok. I gonna explain a little more my situation.
>
> I have a postgres server (Linux) and clients
> (Win2k+delphi application).
> I need create a text file with some columns from a
> table in the server machine, but this file must be
> created only when the user wants. (click button on my
> delphi program on the client side create a text file
> on the server file system).
> I can't share o mount a resource or connect by socket.
> I think execute a postgres function from delphi and
> leave to postgres a work to create the file.
>
> so, my problem is how to create a text file from a
> postgres function. may be I can use a java program
> (like Oracle Java Stored Procedures).
> How I execute a external java program from postgres
> function?
> exist some OS system call in postgres?
>
> something like
> Create or Replace Function run () returns int4 as
> begin
> execute_OS_system_call('java -jar someapp.jar');
> return (1);
> end;

Well. Although there is a project for java as function
language, I dont think its the best option when you
look at startup times and memory footprint.
You can either do with temp tables and copy
or use any of the *u languages (u=unrestricted)

for example plpythonu

CREATE FUNCTION makefile(text) RETURNS text AS '
o=open("/path/to/file")
o.write(args[0])
o.close()
return "ok"
' LANGUAgE plpythonu;

Regards
Tino

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Net Virtual Mailing Lists 2004-11-06 14:34:01 Can this be indexed?
Previous Message edward ohare 2004-11-06 13:29:16 Re: ALERT This mailing list may be voted into a newsgroup