Re: Automate copy - Postgres 9.2

From: rob stone <floriparob(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Patrick B <patrickbakerbr(at)gmail(dot)com>
Cc: John R Pierce <pierce(at)hogranch(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Automate copy - Postgres 9.2
Date: 2016-06-09 19:15:25
Message-ID: 1465499725.7425.3.camel@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2016-06-08 at 23:50 -0400, David G. Johnston wrote:
>
> POn Wednesday, June 8, 2016, Patrick B <patrickbakerbr(at)gmail(dot)com>
> wrote:
> > > ERROR:  syntax error at or near "||"
> > > LINE 12:     TO '/var/lib/pgsql/' || crtrow.account_id |...
> >
>
> Which tells me you cannot use an expression as a file name.  The docs
> support this conclusion.
>
> You probably need to use EXECUTE after constricting a string.
>
> You could also try psql in a shell script.
>
> David J. 

If this is something that you'll never ever have to do again in the
future, you could download ExecuteQuery which has a function to export
a result set as either XML or CSV delimited file output.

OTOH, if this is going to be something run on a regular basis, I think
you'd be better off writing a little program, or as David suggested
embedding this into a shell script.

HTH,
Rob

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex Magnum 2016-06-09 20:45:13 Retrieving comment of rules and triggers
Previous Message Tom Lane 2016-06-09 14:12:54 Re: [pg_trgm] Making similarity(?, ?) < ? use an index