pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Karel Zak <zakkr@zf.jcu.cz>
Cc: pgsql-patches <pgsql-patches@postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Aasmund Midttun Godal <postgresql@envisity.com>
Subject: Re: [SQL] Unpredictable text -> date implicit casting behaviour/to_date
Date: Wed, 2 Jan 2002 13:26:31 -0500 (EST)
Message-ID: <200201021826.g02IQVa10644@candle.pha.pa.us> (raw)
In-Reply-To: <20020102140407.C11749@zf.jcu.cz>


Thomas added datetime stuff over the weekend, so I assume this patch
should be applied in the next 24 hours, unless someone objects.

---------------------------------------------------------------------------

Karel Zak wrote:
> On Mon, Dec 31, 2001 at 11:02:47AM -0500, Tom Lane wrote:
> > "Aasmund Midttun Godal" <postgresql@envisity.com> writes:
> > > The implicit casting of text to date is normally quite good, however i
> > > think it should only use one method during a given query (or maybe
> > > transaction?)
> > 
> > Try setting DateStyle to match the date style you are using.  Postgres
> > is doing the best it can with ambiguous input.
> > 
> > > Added to the fact that to_date has a bug:
> > 
> > > SELECT ordredato, ordredato::date, to_date(ordredato, 'DD.MM.YY') from old_faktura where status = 'ANN';
> > >  ordredato |  ?column?  |    to_date    
> > > -----------+------------+---------------
> > >  18.04.00  | 2000-04-18 | 0001-04-18 BC
> > >  30.08.01  | 2001-08-30 | 2001-08-30
> > >  18.04.00  | 2000-04-18 | 0001-04-18 BC
> > 
> > I agree, this is not desired behavior.  The problem seems to be that the
> > logic in to_timestamp() tries to use "field is not zero" as a substitute
> > test for "field was provided".  At least in the case of the year fields,
> > this is *not* workable.  There must be a separate flag bit.
> > 
> > 			regards, tom lane
> 
>  Nice bug :-(
> 
>  It's fixed and the patch is attached, please apply it to 7.2.
> 
>  Thanks for report.
> 
>         Karel
> 
> -- 
>  Karel Zak  <zakkr@zf.jcu.cz>
>  http://home.zf.jcu.cz/~zakkr/
>  
>  C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

[ Attachment, skipping... ]

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (5+ messages)  latest in thread

Message-ID: <200201021826.g02IQVa10644@candle.pha.pa.us>
Permalink:  ../200201021826.g02IQVa10644@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200201021826.g02IQVa10644@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pgman@candle.pha.pa.us, zakkr@zf.jcu.cz, pgsql-patches@postgresql.org, tgl@sss.pgh.pa.us, postgresql@envisity.com
  Subject: Re: [SQL] Unpredictable text -> date implicit casting behaviour/to_date
  In-Reply-To: <200201021826.g02IQVa10644@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox