Re: issue with an assembled date field

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: excalibur(at)accesswave(dot)ca
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: issue with an assembled date field
Date: 2008-02-29 18:47:40
Message-ID: 10264.1204310860@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chris Bowlby <excalibur(at)accesswave(dot)ca> writes:
> I am converting an encoded field (lot_id) into a date field, the 5
> character of every lot_id is always the year and as such I need to
> extract the year using the following function:
> substring(ilch.lot_id::text, 5, 1)

Well, I'd say that the failure proves that some of your data does
*not* have the year in the fifth character.

> ERROR: invalid input syntax for type date: "01/01/0W"

Time for some data sanitizing?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message brian 2008-02-29 18:53:18 Re: issue with an assembled date field
Previous Message abracadabuda 2008-02-29 18:40:18 Re: pgsql structure export to XML