Search Postgresql Archives

Re: psql & unix env variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 the double quotes. That allows your shell to interpolate the string
into your query. Note that the interpolation is done by your shell, and
not psql.

> 
> 
> 
> Doug Little
> 
> Sr. Data Warehouse Architect | Business Intelligence Architecture | Orbitz Worldwide
> 500 W. Madison, Suite 1000  Chicago IL 60661| Office 312.260.2588 | Fax 312.894.5164 | Cell 847-997-5741
> Douglas.Little@xxxxxxxxxx<mailto:Douglas.Little@xxxxxxxxxx>
>  [cid:image001.jpg@01CD85E2.C7732E50]   orbitz.com<http://www.orbitz.com/> | ebookers.com<http://www.ebookers.com/> | hotelclub.com<http://www.hotelclub.com/> | cheaptickets.com<http://www.cheaptickets.com/> | ratestogo.com<http://www.ratestogo.com/> | asiahotels.com<http://www.asiahotels.com/>
> 

-Ryan Kelly


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux