Re: psql & unix env variables
От | Little, Douglas |
---|---|
Тема | Re: psql & unix env variables |
Дата | |
Msg-id | 8585BA53443004458E0BAA6134C5A7FBB0195824@EGEXCMB01.oww.root.lcl обсуждение исходный текст |
Ответ на | Re: psql & unix env variables (Ryan Kelly <rpkelly22@gmail.com>) |
Ответы |
Re: psql & unix env variables
|
Список | pgsql-general |
Thanks -----Original Message----- From: Ryan Kelly [mailto:rpkelly22@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, 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 isdone 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@orbitz.com<mailto:Douglas.Little@orbitz.com> > [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
В списке pgsql-general по дате отправления: