Обсуждение: Date formats in 7.0b2

Поиск
Список
Период
Сортировка

Date formats in 7.0b2

От
"Hernan J. Gonzalez"
Дата:
I'm puzzled with the date formats in
the 7.0b2 version. Perhaps I'm missing something
trivial, (SQL standards?) but I have been using postgres
from years, and never had this kind of problem.

I use the -e switch, so that
> dates passed to and from the
> frontend processes will be
> assumed to be in "European" format (DD-MM-YYYY)
(from the postgres man page)

Now, it seems that 7.0b2  accepts dates in this
format  AS INPUT but the dates  in the OUTPUT
are always in the YYYY-MM-DD  format ...

Needless to say, this has devasting effects on
my scripts!

Further, postgres seems to accept BOTH
formats as input, and even with 2 digits
in the year... and with some strange results.
I attach some queries below.

Regards

Hernan Gonzalez
Buenos Aires, Argentina
hgonzal@sinectis.com.ar

#######################################################################

 testdb=# select fecha from eventos where fecha >= '31-01-2001';
    fecha
 ------------
  2001-02-01
  2001-03-01
  2002-01-01
  2002-02-01
 (4 rows)

It accepts european DD-MM-YYYY date (ok) but outputs YYYY-MM-DD  (?)
(Doesn't seem to be a psql issue)


 testdb=# select fecha from eventos where fecha >= '01-31-2001';
 ERROR:  Bad date external representation '01-31-2001'

Refuses MM-DD-YYYY date (ok, I'm usign the -e switch ) ]


 testdb=# select fecha from eventos where fecha >= '2001-01-31';
    fecha
 ------------
  2001-02-01

  2001-03-01
  2002-01-01
  2002-02-01
 (4 rows)

Accepts YYYY-MM-DD also ...


 testdb=# select fecha from eventos where fecha >= '01-01-01';
    fecha
 ------------
  2001-01-01
  2001-02-01
  2001-03-01
  2002-01-01
  2002-02-01
 (5 rows)

Accepts DD-MM-YY  also  ....


 testdb=# select fecha from eventos where fecha >= '1-1-1';
    fecha
 ------------
  2000-02-01
  2000-04-01
  2000-05-01
  2000-06-01
  2000-07-01
  2000-08-01
  2000-09-01
  2000-10-01
  2000-11-01
  2000-11-17
  2000-12-20
  2001-01-01
  2001-02-01
  2001-03-01
  2002-01-01
  2002-02-01
 (17 rows)

?? What does this mean ????


Now, let's see what if XX-XX-XX is understood as DD-MM-YY or YY-MM-DD ...

 testdb=# select fecha from eventos where fecha >= '03-02-01';
    fecha
 ------------
  2001-03-01
  2002-01-01
  2002-02-01
 (3 rows)


testdb=# select fecha from eventos where fecha >= '01-02-03';
 fecha
-------
(0 rows)

.... so, XX-XX-XX is understood as DD-MM-YY




__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Re: Date formats in 7.0b2

От
Karel Zak
Дата:
On Wed, 5 Apr 2000, Hernan J. Gonzalez wrote:

> I'm puzzled with the date formats in
> the 7.0b2 version. Perhaps I'm missing something
> trivial, (SQL standards?) but I have been using postgres
> from years, and never had this kind of problem.
>
> I use the -e switch, so that
> > dates passed to and from the
> > frontend processes will be
> > assumed to be in "European" format (DD-MM-YYYY)
> (from the postgres man page)
>
> Now, it seems that 7.0b2  accepts dates in this
> format  AS INPUT but the dates  in the OUTPUT
> are always in the YYYY-MM-DD  format ...
>


 You can use in 7.0 to_char() to_date() to_timestamp() functions for full
date-time format controlling or conversion.

                        Karel


Advice about -B n_buffers option

От
Robert Williams
Дата:
I have a postmaster process that is crashing periodically.
I haven't turned on debugging yet, but I suspect the
number of buffers may be low (its 64).
Does anyone have some general observations about
the importance of having more buffers?



      -B n_buffers
           n_buffers is the number of shared-memory buffers  for
           the postmaster to allocate and manage for the backend
           server processes that it starts.  This value defaults
           to 64, and each buffer is 8k bytes.

as in "postmaster -D /usr/local/var/Postgresql -B 128"


--
Bob Williams, http://bob.usuhs.mil/
office: 301-295-3568