Results 1 to 3 of 3

Thread: Select Extract

  1. #1
    Join Date
    Aug 2003
    Posts
    8

    Unanswered: Select Extract

    SELECT EXTRACT(YEAR FROM TIMESTAMP(MIN(xact_date))) AS "Year", EXTRACT(MONTH FROM TIMESTAMP(MIN(xact_date))) AS "Month", EXTRACT(DAY FROM TIMESTAMP(MIN(xact_date))) AS "Day" FROM history_20030704;

    Hi,

    Can anyone please tell me why the above statement will work with postgres 7.1 but gives me the following error in 7.3.2 & above


    ERROR: parser: parse error at or near "MIN" at character 36

    thanks

  2. #2
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    Casting

    Looks like to me as a change in the system
    TRy to ask your question in the usenet in the sql list
    there are the real SQL-Hackers :-)
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  3. #3
    Join Date
    Aug 2003
    Posts
    1

    Re: Select Extract

    Around 7.1 Timestamps with timezones were introduced.
    Change your query so that TIMESTAMP is TIMESTAMPTZ
    and it should work fine in 7.3 even if your column is of type
    timestamp and not timestamptz.

    --elein@varlena.com

    Originally posted by hughk
    SELECT EXTRACT(YEAR FROM TIMESTAMP(MIN(xact_date))) AS "Year", EXTRACT(MONTH FROM TIMESTAMP(MIN(xact_date))) AS "Month", EXTRACT(DAY FROM TIMESTAMP(MIN(xact_date))) AS "Day" FROM history_20030704;

    Hi,

    Can anyone please tell me why the above statement will work with postgres 7.1 but gives me the following error in 7.3.2 & above


    ERROR: parser: parse error at or near "MIN" at character 36

    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •