Getting Error while using row_number()

Started by Ashish Kaushalalmost 6 years ago4 messagesbugs
Jump to latest
#1Ashish Kaushal
ashish.kaushal@getfareye.com

Hi Team,

I have environment with PostgreSQL 8.0.2 on i686-pc-linux-gnu and I am
trying to write sql syntax like mentioned below and getting mentioned
below.

select distinct journey_id
, ROW_NUMBER OVER (partition by `journey_id` ORDER BY journey_id)
from table_name

You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '(partition by
`journey_id` ORDER BY `journey_id`) from `consents` limit 10' at line 6

Kindly advise asap

Thanks
Ashish Kaushal
8285877270

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Ashish Kaushal (#1)
Re: Getting Error while using row_number()

On Thursday, July 9, 2020, Ashish Kaushal <ashish.kaushal@getfareye.com>
wrote:

Hi Team,

I have environment with PostgreSQL 8.0.2 on i686-pc-linux-gnu and I am
trying to write sql syntax like mentioned below and getting mentioned
below.

select distinct journey_id
, ROW_NUMBER OVER (partition by `journey_id` ORDER BY journey_id)
from table_name

You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '(partition by
`journey_id` ORDER BY `journey_id`) from `consents` limit 10' at line 6

Kindly advise asap

Don’t execute PostgreSQL queries against a MySQL Server.

David J.

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: Ashish Kaushal (#1)
Re: Getting Error while using row_number()

On Thursday, July 9, 2020, Ashish Kaushal <ashish.kaushal@getfareye.com>
wrote:

Hi Team,

I have environment with PostgreSQL 8.0.2

PostgreSQL 8.0.2? Seriously?

David J.

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: David G. Johnston (#3)
Re: Getting Error while using row_number()

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Thursday, July 9, 2020, Ashish Kaushal <ashish.kaushal@getfareye.com>
wrote:

I have environment with PostgreSQL 8.0.2

PostgreSQL 8.0.2? Seriously?

If it actually is 8.0.x, or even 8.2.x, then it lacks window functions
anyway; those came in in 8.4. But there's a bigger problem:

You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '(partition by
`journey_id` ORDER BY `journey_id`) from `consents` limit 10' at line 6

That's not a Postgres error at all. The OP seems quite confused.

regards, tom lane