pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Eckermann <jeckermann@verio.net>
To: 'R Vijayanath' <vijayanath@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: RE: can we write to a flat file from Postgresql procedure
Date: Wed, 11 Jul 2001 10:15:09 -0500
Message-ID: <08CD1781F85AD4118E0800A0C9B8580B094B26@NEZU> (raw)

I don't think there is any way to do this using any of the generally
available tools.

You could do a workaround using pl/pgsql, in the following way:
*	insert your data into a temp table
*	output the data to a file using COPY

pl/pgsql allows INSERT statements, but does not allow CREATE/DROP TABLE or
COPY statements.  Those can be constructed using EXECUTE, which takes a
string (which can be constructed using parameters) and passes it on to be
executed as an SQL statement.

For more information, check out the PostgreSQL documentation, especially on
pl/pgsql (under "Procedural Languages") and COPY (under "SQL Commands").

> -----Original Message-----
> From:	R Vijayanath [SMTP:vijayanath@yahoo.com]
> Sent:	Thursday, July 05, 2001 10:34 AM
> To:	pgsql-sql@postgresql.org
> Subject:	can we write to a flat file from Postgresql procedure
> 
> Hi,
> 
> I found your name in the Postgresql web site.
> 
> It would be great if you can tell me if I can write a
> procedure that can write the output to the OS(Linux
> OS) file.
> 
> Can you assist me on this if there is a way to do it.
> 
> We are using Postgresql 7.1 running in Linux Redhat
> 7.1.
> 
> Thanks in Advance.
> 
> Vijay
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly



view thread (7+ messages)  latest in thread

Message-ID: <08CD1781F85AD4118E0800A0C9B8580B094B26@NEZU>
Permalink:  ../08CD1781F85AD4118E0800A0C9B8580B094B26@NEZU/
Also on:    postgresql.org/message-id/08CD1781F85AD4118E0800A0C9B8580B094B26@NEZU

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jeckermann@verio.net, vijayanath@yahoo.com
  Subject: RE: can we write to a flat file from Postgresql procedure
  In-Reply-To: <08CD1781F85AD4118E0800A0C9B8580B094B26@NEZU>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox