Re: [GENERAL] psql & unix env variables

2012-08-31 Thread Achilleas Mantzios
On Παρ 31 Αυγ 2012 09:37:05 Craig Ringer wrote: > On 08/30/2012 02:42 PM, Achilleas Mantzios wrote: > > I have found useful the use of variable assignment in psql, e.g. > > If you're going to to that, why not drive psql as a coprocess: because it is completely irrelevant with what the OP asked fo

Re: [GENERAL] psql & unix env variables

2012-08-31 Thread Achilleas Mantzios
On Παρ 31 Αυγ 2012 09:19:26 Chris Angelico wrote: > On Thu, Aug 30, 2012 at 4:42 PM, Achilleas Mantzios > wrote: > > I have found useful the use of variable assignment in psql, e.g. > > > > #!/bin/sh > > > > # lets say you have some var with a value, or even populate some var with a > > val

Re: [GENERAL] psql & unix env variables

2012-08-31 Thread Achilleas Mantzios
On Παρ 31 Αυγ 2012 09:37:05 Craig Ringer wrote: > On 08/30/2012 02:42 PM, Achilleas Mantzios wrote: > > I have found useful the use of variable assignment in psql, e.g. > > If you're going to to that, why not drive psql as a coprocess: because it is completely irrelevant with what the OP asked fo

Re: [GENERAL] psql & unix env variables

2012-08-31 Thread Achilleas Mantzios
On Παρ 31 Αυγ 2012 09:19:26 Chris Angelico wrote: > On Thu, Aug 30, 2012 at 4:42 PM, Achilleas Mantzios > wrote: > > I have found useful the use of variable assignment in psql, e.g. > > > > #!/bin/sh > > > > # lets say you have some var with a value, or even populate some var with a > > val

Re: [GENERAL] psql & unix env variables

2012-08-30 Thread Craig Ringer
On 08/30/2012 02:42 PM, Achilleas Mantzios wrote: I have found useful the use of variable assignment in psql, e.g. If you're going to to that, why not drive psql as a coprocess: http://stackoverflow.com/a/8305578/398670 or if at all possible, use a language with sane PostgreSQL bindings.

Re: [GENERAL] psql & unix env variables

2012-08-30 Thread Adrian Klaver
On 08/30/2012 04:19 PM, Chris Angelico wrote: On Thu, Aug 30, 2012 at 4:42 PM, Achilleas Mantzios wrote: I have found useful the use of variable assignment in psql, e.g. #!/bin/sh # lets say you have some var with a value, or even populate some var with a value from # psql as shown below som

Re: [GENERAL] psql & unix env variables

2012-08-30 Thread Chris Angelico
On Thu, Aug 30, 2012 at 4:42 PM, Achilleas Mantzios wrote: > I have found useful the use of variable assignment in psql, e.g. > > #!/bin/sh > > # lets say you have some var with a value, or even populate some var with a > value from > # psql as shown below > somevar=`psql -P pager=off -q -t -c "S

Re: [GENERAL] psql & unix env variables

2012-08-30 Thread Achilleas Mantzios
ittle, Douglas wrote: > Thanks > > > -Original Message- > From: Ryan Kelly [mailto:rpkell...@gmail.com] > Sent: Wednesday, August 29, 2012 12:41 PM > To: Little, Douglas > Cc: PostgreSQL General (pgsql-general@postgresql.org) > Subject: Re: [GENERAL] psql & unix env va

Re: [GENERAL] psql & unix env variables

2012-08-29 Thread Little, Douglas
Thanks -Original Message- From: Ryan Kelly [mailto:rpkell...@gmail.com] Sent: Wednesday, August 29, 2012 12:41 PM To: Little, Douglas Cc: PostgreSQL General (pgsql-general@postgresql.org) Subject: Re: [GENERAL] psql & unix env variables On Wed, Aug 29, 2012 at 12:35:32PM -0500, Li

Re: [GENERAL] psql & unix env variables

2012-08-29 Thread Ryan Kelly
On Wed, Aug 29, 2012 at 12:35:32PM -0500, Little, Douglas wrote: > Is there a method for having unix env variables incorporated into a psql sql > statement? > Ie > Export var='dev' > Psql =c 'select count(*) from $var.customer;' export FOO="bar" psql -c "select count(*) from $FOO.customer;" Note

Re: [GENERAL] psql & unix env variables

2012-08-29 Thread Alan Hodgson
On Wednesday, August 29, 2012 12:35:32 PM Little, Douglas wrote: > Is there a method for having unix env variables incorporated into a psql sql > statement? Ie > Export var='dev' > Psql =c 'select count(*) from $var.customer;' > Use double-quotes, not single-quotes. Bash won't interpolate variabl

[GENERAL] psql & unix env variables

2012-08-29 Thread Little, Douglas
Is there a method for having unix env variables incorporated into a psql sql statement? Ie Export var='dev' Psql =c 'select count(*) from $var.customer;' Doug Little Sr. Data Warehouse Architect | Business Intelligence Architecture | Orbitz Worldwide 500 W. Madison, Suite 1000 Chicago IL 606