Am 2008-09-11 10:03:03, schrieb Roderick A. Anderson:
> Whatever happened to pgbash? I see the last update was Feb 2003 but
> that was for Pg v7.3.
I have tried it soe times ago with 7.4 but goten to many errors...
...and gaved up.
Thanks, Greetings and nice Day/Evening
Michelle Konzack
> Ok then. Does anyone have any tips or best practices for scripting psql?
>
> I'll probably write some bash scripts to pull csv files over then script
> psql to do a COPY into an import schema then run a pl/pgsql procedure, er
> function, to do all ETL.
>
> Who else is doing something like this? C
Alvaro Herrera wrote:
Doesn't say about variable expansion ... And it seems to be in a
different realm, because the point is that the command is going to have
a single destination (either \-processing or sending it to the server).
Is psql being just lazy here and avoiding parsing the command?
$ TEST=16; psql -c "select $TEST as \"input1\";"
$ TEST=16; echo "select $TEST as \"input1\";" | psql
Yep that works. My coworker also suggested using
-- Original message --
From: "Roderick A. Anderson" <[EMAIL PROTECTED]>
> Kevin Hunter wrote:
> > At 7:13am -0400 on Thu, 11 Sep 2008, Harald Fuchs wrote:
> >> Nice trick, but when I try the following variant:
> >>
> >> psql -v TEST=16 -c 'select :TEST as "input"'
Kevin Hunter wrote:
At 7:13am -0400 on Thu, 11 Sep 2008, Harald Fuchs wrote:
Nice trick, but when I try the following variant:
psql -v TEST=16 -c 'select :TEST as "input"'
I get [a syntax error]
This seems to be contrary to the psql manual page:
Nope. Take a look at the -c option. Spe
At 7:13am -0400 on Thu, 11 Sep 2008, Harald Fuchs wrote:
> Nice trick, but when I try the following variant:
>
> psql -v TEST=16 -c 'select :TEST as "input"'
>
> I get [a syntax error]
> This seems to be contrary to the psql manual page:
Nope. Take a look at the -c option. Specifically "Thu
Peter Eisentraut escribió:
> psql manual page:
>
>-c command
>
>--command command
> Specifies that psql is to execute one command string, command,
> and then exit. This is useful in shell scripts.
>
> command must be either a command string that is completely
Harald Fuchs wrote:
In article <[EMAIL PROTECTED]>,
Greg Smith <[EMAIL PROTECTED]> writes:
On Tue, 9 Sep 2008, Artacus wrote:
Can psql access environmental variables or command line params?
$ cat test.sql
select :TEST as "input";
$ psql -v TEST=16 -f test.sql
input
---
16
(1 row)
Harald Fuchs escribió:
> Nice trick, but when I try the following variant:
>
> psql -v TEST=16 -c 'select :TEST as "input"'
>
> I get
>
> ERROR: syntax error at or near ":"
> LINE 1: select :TEST as "input"
>
> This seems to be contrary to the psql manual page:
>
> These assignments a
In article <[EMAIL PROTECTED]>,
Greg Smith <[EMAIL PROTECTED]> writes:
> On Tue, 9 Sep 2008, Artacus wrote:
>> Can psql access environmental variables or command line params?
> $ cat test.sql
> select :TEST as "input";
> $ psql -v TEST=16 -f test.sql
> input
> ---
> 16
> (1 row)
Nice tr
On Tue, 9 Sep 2008, Artacus wrote:
Can psql access environmental variables or command line params?
$ cat test.sql
select :TEST as "input";
$ psql -v TEST=16 -f test.sql
input
---
16
(1 row)
You can find out more about what you can do with variable substitution at
http://www.postgres
On Wed, Sep 10, 2008 at 10:14 PM, Artacus <[EMAIL PROTECTED]> wrote:
>> This sounds a lot like what I did in my last job using bash for most
>> things, and php for the more complicated stuff. Wrote a simple oracle
>> to pgsql table replicator in php that worked pretty well.
>
> Well we do this stu
This sounds a lot like what I did in my last job using bash for most
things, and php for the more complicated stuff. Wrote a simple oracle
to pgsql table replicator in php that worked pretty well.
Well we do this stuff all the time with Oracle and sql*plus. And I've
heard people hear say about
On Wed, Sep 10, 2008 at 12:46 AM, Artacus <[EMAIL PROTECTED]> wrote:
> Artacus wrote:
>>
>> I'd like to learn a little more about writing psql scripts does anyone
>> know of any resources outside of the manual?
>
> Ok then. Does anyone have any tips or best practices for scripting psql?
>
> I'll pr
On Sep 10, 2008, at 2:46 AM, Artacus wrote:
Who else is doing something like this? Can psql access environmental
variables or command line params? Or do I have to have my bash
script write a psql script every time?
The psql \! command can execute shell commands. You can also use ``,
e.g
Artacus wrote:
I'd like to learn a little more about writing psql scripts does anyone
know of any resources outside of the manual?
Ok then. Does anyone have any tips or best practices for scripting psql?
I'll probably write some bash scripts to pull csv files over then script
psql to do a
17 matches
Mail list logo