[postgis-users] quickie question

Jessica M Salmon jmsalmon at fs.fed.us
Tue May 2 09:30:02 PDT 2006


Steve,

thank you so much for explaining that so clearly, and giving such a simple
solution! I can't wait to go fix that function and get this done right : )

-Meghan


                                                                           
             Stephen Marshall                                              
             <smarshall at wsi.co                                             
             m>                                                         To 
             Sent by:                  postgis-users at postgis.refractions.n 
             postgis-users-bou         et                                  
             nces at postgis.refr                                          cc 
             actions.net                                                   
                                                                   Subject 
                                       [postgis-users] quickie question    
             05/02/2006 10:06                                              
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
               PostGIS Users                                               
                Discussion                                                 
             <postgis-users at po                                             
             stgis.refractions                                             
                   .net>                                                   
                                                                           
                                                                           




Meghan,

You are trying to use psql backslash commands within a plpgsql
server-side function.  The backslash commands are specific just to the
psql application, which is just one specific PostgreSQL client
application.  The plpglsql code runs within the PostgreSQL backend (i.e.
on the server-side), and hence is independent of which client program or
interface you are using.

Typically, to output the results of a server-side function to a file,
write your function to return a set of records, i.e. SETOF <table_name
or aggregate data type>.   You can define the record type either with
the create table or create type commands.

Then, execute your function using psql (or another client application)
and redirect the output of the client application into a file.

e.g. This command will output your query results as comma-separated
variables and redirect it into a file.

psql --no-align -F, --pset footer -c "your query" yourdb  >  yourfile

Yours,
Steve Marshall
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list