Re: formatting a date when some nulls exist
| От | Eric Walstad | 
|---|---|
| Тема | Re: formatting a date when some nulls exist | 
| Дата | |
| Msg-id | 3D7588B6.9010906@walstads.net обсуждение исходный текст | 
| Ответ на | formatting a date when some nulls exist (Eric Walstad <eric@walstads.net>) | 
| Ответы | Re: formatting a date when some nulls exist | 
| Список | pgsql-novice | 
Hi Tom,
Here's the version:
ewtest=# select version();
                            version
-------------------------------------------------------------
  PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96
(1 row)
...and...
[ewalstad@uluwatu ewalstad]$ uname -a
Linux uluwatu 2.4.18-10 #1 Wed Aug 7 11:39:21 EDT 2002 i686 unknown
Thanks for your time and assistance!
Eric.
Tom Lane wrote:
> Eric Walstad <eric@walstads.net> writes:
>
>>I'm trying to format a date type column, which contains some nulls.  I'm
>>getting an error:
>
>
>>ewtest=# select to_char(birthday, 'YYYY-MM-DD') from contacts;
>>ERROR:  Unable to convert date to tm
>
>
> How old is your Postgres??  AFAIR that misbehavior has been gone since
> 6.5 or so.  Certainly any recent version works:
>
> regression=# create table foo (f1 date);
> CREATE TABLE
> regression=# insert into foo values('today');
> INSERT 288761 1
> regression=# insert into foo values(null);
> INSERT 288762 1
> regression=# select to_char(f1, 'YYYY-MM-DD') from foo;
>   to_char
> ------------
>  2002-09-02
>
> (2 rows)
>
> regression=#
>
>             regards, tom lane
		
	В списке pgsql-novice по дате отправления: