From: | hubert depesz lubaczewski <depesz(at)depesz(dot)com> |
---|---|
To: | Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Substring Problem |
Date: | 2008-05-13 13:30:35 |
Message-ID: | 20080513133035.GA32453@depesz.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, May 13, 2008 at 03:26:57PM +0200, Stefan Schwarzer wrote:
> it seems to work with 8.1, but not anymore with 8.3. What is wrong
> with this substring request? Or is it some installation issue? Thanks
> for any suggestion!
> SELECT substring(date from 1 for 7) AS stryearmonth, COUNT(id) AS
> countofnumber FROM (SELECT * from downloads ) AS foo GROUP BY
> stryearmonth ORDER BY stryearmonth ASC
in release notes it says that 8.3 removes some implicit casts. for
example the ones from date to text.
change your substring to:
to_char(date, 'YYYY-MM')
and You should be fine.
depesz
--
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA. here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)
From | Date | Subject | |
---|---|---|---|
Next Message | IVO GELOV | 2008-05-13 13:33:50 | Strange behaviour - performance decreases after each TRUNCATE |
Previous Message | Stefan Schwarzer | 2008-05-13 13:26:57 | Substring Problem |