pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
to_char() and order-by
3+ messages / 2 participants
[nested] [flat]

* to_char() and order-by
@ 2002-06-27 19:27  Jeff Boes <jboes@nexcerpt.com>
  0 siblings, 1 reply; 3+ messages in thread

From: jboes@nexcerpt.com @ 2002-06-27 19:27 UTC (permalink / raw)
  To: pgsql-sql

Perhaps this was covered in the 7.2.x release notes, but it's mystifying us:

select to_char(time_link,'999.99') from stat_fetch
where time_link is not null
order by 1 desc limit 10;

(time_link is a double-precision column.)  Under 7.1.3, this returns results like:

 to_char 
---------
    9.99
    9.99
    9.99
    9.99
    9.99
    9.99
    9.99
    9.99
    9.99
    9.99
(10 rows)

while under 7.2.1, you get the top 10 rows in *numerical* order:

 to_char 
---------
  278.78
  261.07
  240.25
  180.24
  173.26
  160.35
  159.02
  144.57
  134.21
  131.66
(10 rows)





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: to_char() and order-by
@ 2002-06-28 07:59  Karel Zak <zakkr@zf.jcu.cz>
  parent: Jeff Boes <jboes@nexcerpt.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Karel Zak @ 2002-06-28 07:59 UTC (permalink / raw)
  To: Jeff Boes <jboes@nexcerpt.com>; +Cc: pgsql-sql

On Thu, Jun 27, 2002 at 12:27:11PM -0700, Jeff Boes wrote:
> Perhaps this was covered in the 7.2.x release notes, but it's mystifying us:

 Please, how are data without to_char()? 
 
 select time_link from stat_fetch 
 where time_link is not null 
 order by 1 desc limit 10;

    Karel

> select to_char(time_link,'999.99') from stat_fetch
> where time_link is not null
> order by 1 desc limit 10;
> 
> (time_link is a double-precision column.)  Under 7.1.3, this returns results like:
> 
>  to_char 
> ---------
>     9.99
>     9.99
>     9.99
>     9.99
>     9.99
>     9.99
>     9.99
>     9.99
>     9.99
>     9.99
> (10 rows)
> 
> while under 7.2.1, you get the top 10 rows in *numerical* order:
> 
>  to_char 
> ---------
>   278.78
>   261.07
>   240.25
>   180.24
>   173.26
>   160.35
>   159.02
>   144.57
>   134.21
>   131.66
> (10 rows)

-- 
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/
 
 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: to_char() and order-by
@ 2002-06-28 12:48  Jeff Boes <jboes@nexcerpt.com>
  parent: Karel Zak <zakkr@zf.jcu.cz>
  0 siblings, 0 replies; 3+ messages in thread

From: Jeff Boes @ 2002-06-28 12:48 UTC (permalink / raw)
  To: Karel Zak <zakkr@zf.jcu.cz>; +Cc: pgsql-sql

On Fri, 2002-06-28 at 03:59, Karel Zak wrote:
> On Thu, Jun 27, 2002 at 12:27:11PM -0700, Jeff Boes wrote:
> > Perhaps this was covered in the 7.2.x release notes, but it's mystifying us:
> 
>  Please, how are data without to_char()? 
>  
>  select time_link from stat_fetch 
>  where time_link is not null 
>  order by 1 desc limit 10;
> 

A sample:

   time_link     
------------------
 113.532913923264
 105.676617980003
  96.575364947319
 96.3684740066528
 95.3645260334015
 84.6487939357758
 83.9759339094162
 78.2595579624176
 78.0376229286194
  76.875627040863
(10 rows)



-- 
Jeff Boes                                      vox 616.226.9550 ext 24
Database Engineer                                     fax 616.349.9076
Nexcerpt, Inc.                                 http://www.nexcerpt.com
           ...Nexcerpt... Extend your Expertise






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-06-28 12:48 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-06-27 19:27 to_char() and order-by Jeff Boes <jboes@nexcerpt.com>
2002-06-28 07:59 ` Karel Zak <zakkr@zf.jcu.cz>
2002-06-28 12:48   ` Jeff Boes <jboes@nexcerpt.com>

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