Thread: date validation problem
sir, in postgresql 7.3.2 when we are trying to query like select to_date('665555555','ddmmyyyy'); the output is 5559-09-06 it is not validating the day and month and unknown format is the output.. any help regarding this is greatful... thank you
I don't see the problem... you are specifying the 66th day of the 55th month in the year 5555. just a cursory glance says that 48 months is 4 years... that gives the year as 5559. try your example with real numbers (unless these are real) select to_date('13122003','ddmmyyyy'); to_date ------------ 2003-12-13 (1 row) Ted --- Sh A Guru Prasad <guru@ap.nic.in> wrote: > > sir, > > in postgresql 7.3.2 when we are trying to query like > > select to_date('665555555','ddmmyyyy'); > > the output is > > 5559-09-06 > > it is not validating the day and month and unknown > format > is the output.. > > any help regarding this is greatful... > > thank you > > > > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings __________________________________ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/
On Mon, Dec 29, 2003 at 05:47:56AM -0800, Theodore Petrosky wrote: > > I don't see the problem... you are specifying the 66th > day of the 55th month in the year 5555. just a cursory > glance says that 48 months is 4 years... that gives > the year as 5559. try your example with real numbers > (unless these are real) (Assuming a typo, the select() showed the 665th day). But there is no 55th month and no 66th day of that month, the conversion should simply fail and abort the transaction with an error, shouldn't it ? -- Michael van Elst Internet: mlelstv@serpens.de "A potential Snark may lurk in every tree."
Michael van Elst <mlelstv@serpens.de> writes: > But there is no 55th month and no 66th day of that month, > the conversion should simply fail and abort the transaction > with an error, shouldn't it ? I believe this is an acknowledged bug in to_date, which Karel hasn't yet got around to fixing. regards, tom lane
On Mon, Dec 29, 2003 at 11:04:06AM -0500, Tom Lane wrote: > Michael van Elst <mlelstv@serpens.de> writes: > > But there is no 55th month and no 66th day of that month, > > the conversion should simply fail and abort the transaction > > with an error, shouldn't it ? > > I believe this is an acknowledged bug in to_date, which Karel hasn't > yet got around to fixing. This feature/bug will probably removed/fixed in 7.5. Karel -- Karel Zak <zakkr@zf.jcu.cz> http://home.zf.jcu.cz/~zakkr/