Re: environment variables, output format & setting current date

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: Brent Wood <baw(at)frc(dot)niwa(dot)cri(dot)nz>, pgsql-general(at)postgresql(dot)org
Subject: Re: environment variables, output format & setting current date
Date: 2002-02-22 15:37:13
Message-ID: 20020222153713.24550.qmail@web20805.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

psql <db> -A -t -c "select current_date;" will do what
you appear to want.

But, as already pointed out, you are probably better
off using the methods provided in your scripting
language (shell or whatever).

--- Brent Wood <baw(at)frc(dot)niwa(dot)cri(dot)nz> wrote:
>
> Three questions:
>
>
> 1. In a script, how do I set the value of a date
> attr to the current
> date. I've tried a few obvious approaches but
> nothing works yet.
>
>
>
> 2.If I do:
> psql <db> -c "select current_date;"
> I get:
>
> date
> ------------
> 2002-02-23
> (1 row)
>
> I can use:
> psql <db> -c "select current_date;" | tail
> -3 | head -1
> to just get the date value, but is there simpler
> way?
>
>
> And lastly, I believe there are a few environmental
> variables used to
> control various PostgreSQL behaviours, eg: date/time
> format. Where is
> there a list of these? (I can't find them in the
> docs)
>
> Thanks
>
>
>
=============================================================================
>
> _-''-_ <Brent Wood> b(dot)wood(at)niwa(dot)cri(dot)nz
> Ph: +64(4)386-0300
> 'o \/ NIWA, Box 14901,
> > ) /\ Kilbirnie, Wellington, New Zealand
>
> `-===-' #include <std_disclaimer>
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lincoln Yeoh 2002-02-22 15:47:14 Re: Protection of intellectual property (Schema & SQL code)
Previous Message Samuel J. Sutjiono 2002-02-22 15:30:30 Re: How does Index Scan get used