Thread: to_char() causes backend to close connection

to_char() causes backend to close connection

From
Kovacs Zoltan Sandor
Date:
Hi, this query gives different strange results:

select to_char(now()::abstime,'YYMMDDHH24MI');

I get e.g. a "backend closed the channel unexpectedly..." error with
successful or failed resetting attempt (indeterministic)

or

ERROR:  to_char/to_number(): not unique decimal poit

or

NOTICE:  PortalHeapMemoryFree: 0x0x8201af0 not in alloc set

My machine works with PostgreSQL 7.0.2 + Red Hat 6.1.
Is this fixed in 7.0.3?

TIA, Zoltan




Re: to_char() causes backend to close connection

From
Karel Zak
Date:
On Thu, 14 Dec 2000, Kovacs Zoltan Sandor wrote:

> Hi, this query gives different strange results:
> 
> select to_char(now()::abstime,'YYMMDDHH24MI');

the result:

ERROR:  to_char/to_number(): not unique decimal poit

is right, because we have two to_char():
to_char(int, text) to_char(timestamp, text)

and for 'now()::abstime' function manager select "number" version
instead timestamp.
And in "number" version is D as decimal point.

> I get e.g. a "backend closed the channel unexpectedly..." error with
> successful or failed resetting attempt (indeterministic)
Yes this is a bug to_char() ... I fix it today.

> My machine works with PostgreSQL 7.0.2 + Red Hat 6.1.
> Is this fixed in 7.0.3?
A problem (IMHO it's not problem) with 'now()::abstime' is in 7.1 too. 
But why you not use directly now()?

Thanks!                Karel



Re: to_char() causes backend to close connection

From
Kovacs Zoltan Sandor
Date:
>  A problem (IMHO it's not problem) with 'now()::abstime' is in 7.1 too. 
> But why you not use directly now()?
My aim is to get this format for the time '5 minutes ago'. So I need
something like

select to_char(now()-'5 minutes','YYMMDDHH24MI')

but this doesn't work due to the missing type conversion.

Any idea? TIA, Zoltan



RE: to_char() causes backend to close connection

From
"Trewern, Ben"
Date:
<p><font size="2">select to_char(now()-'5 minutes'::interval,'YYMMDDHH24MI') seems to work</font><p><font
size="2">Ben</font><p><fontsize="2">> -----Original Message-----</font><br /><font size="2">> From: Kovacs Zoltan
Sandor[<a href="mailto:tip@pc10.radnoti-szeged.sulinet.hu">mailto:tip@pc10.radnoti-szeged.sulinet.hu</a>]</font><br
/><fontsize="2">> Sent: 14 December 2000 15:49</font><br /><font size="2">> To: Karel Zak</font><br /><font
size="2">>Cc: pgsql-sql@postgresql.org</font><br /><font size="2">> Subject: Re: [SQL] to_char() causes backend
toclose connection</font><br /><font size="2">> </font><br /><font size="2">> </font><br /><font size="2">>
> A problem (IMHO it's not problem) with 'now()::abstime' is </font><br /><font size="2">> in 7.1 too. </font><br
/><fontsize="2">> > But why you not use directly now()?</font><br /><font size="2">> My aim is to get this
formatfor the time '5 minutes ago'. So I need</font><br /><font size="2">> something like</font><br /><font
size="2">></font><br /><font size="2">> select to_char(now()-'5 minutes','YYMMDDHH24MI')</font><br /><font
size="2">></font><br /><font size="2">> but this doesn't work due to the missing type conversion.</font><br
/><fontsize="2">> </font><br /><font size="2">> Any idea? TIA, Zoltan</font><br /><font size="2">> </font>