Re: losing my mind about sytnax error in window clause

From: Bob Edwards <bob(at)cs(dot)anu(dot)edu(dot)au>
To: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re: losing my mind about sytnax error in window clause
Date: 2022-06-07 23:46:18
Message-ID: 6900b4c7-f2d3-267d-4a83-2434b0c6fe07@cs.anu.edu.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 8/6/22 09:03, Rein Petersen wrote:
> Hi Folks,
>
> I've been reading the docs over and again, searching exhaustively for
> examples on the internet to help me here and I'm ready to give up.
>
> I have a query using windows function:
>
> SELECT
>     last_value ( typechange )      OVER w,
>     pindex,
>     lid,
>     last_value ( modified )   OVER w,
>     last_value ( created )    OVER w,
>     last_value ( modifiedby ) OVER w,
>     last_value ( createby )   OVER w,
>     last_value ( cost ) FILTER ( WHERE cost IS NOT NULL ) OVER w,
>     last_value ( sell ) FILTER ( WHERE sell IS NOT NULL ) OVER w
> FROM ps._delta_ext
> WHERE pindex = Ppindex AND
>     ( Plid IS NULL OR lid = Plid ) AND
>     ( Ptimestamp IS NULL OR modified <= Ptimestamp )
> GROUP BY lid, pindex
> WINDOW w AS ( PARITION BY lid, pindex ORDER BY created );
> Complains about syntax error in the WINDOW cause (last line) on
> [PARTITION] BY:
> /* messages
> ERROR:  syntax error at or near "BY"
> LINE 16:  WINDOW w AS ( PARITION BY locationid, partindex ORDER BY cr...
>                                  ^
> SQL state: 42601
> Character: 2724
> */
>
> Maybe my error is clear to someone else, could really use helping hand,
> thanks.
>
> Rein

PARITION <> PARTITION - check your spelling.

cheers,
Bob Edwards.

>
>
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rein Petersen 2022-06-08 00:14:32 Re: losing my mind about sytnax error in window clause
Previous Message Rob Sargent 2022-06-07 23:45:24 Re: losing my mind about sytnax error in window clause