pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #15839: Using text field for sorting in prepared query leads to wrong result
2+ messages / 2 participants
[nested] [flat]
* BUG #15839: Using text field for sorting in prepared query leads to wrong result
@ 2019-06-07 14:30 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2019-06-07 14:30 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: me@helld.ru
The following bug has been logged on the website:
Bug reference: 15839
Logged by: Александр Черников
Email address: me@helld.ru
PostgreSQL version: 10.6
Operating system: Ubuntu 18.04.1
Description:
Example request:
select * from orders where ClientId=$1 and Moment >= $2 and Moment < $3
order by $4 desc, ClientId limit $5 offset ($5-1)*$6;
Field in question is $4
Expected result - poor performance or clear error that dynamic sorting
cannot be used
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #15839: Using text field for sorting in prepared query leads to wrong result
@ 2019-06-07 16:06 David G. Johnston <david.g.johnston@gmail.com>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: David G. Johnston @ 2019-06-07 16:06 UTC (permalink / raw)
To: me@helld.ru; pgsql-bugs@lists.postgresql.org
On Fri, Jun 7, 2019 at 7:31 AM PG Bug reporting form <noreply@postgresql.org>
wrote:
> The following bug has been logged on the website:
>
> Bug reference: 15839
> Logged by: Александр Черников
> Email address: me@helld.ru
> PostgreSQL version: 10.6
> Operating system: Ubuntu 18.04.1
> Description:
>
> Example request:
> select * from orders where ClientId=$1 and Moment >= $2 and Moment < $3
> order by $4 desc, ClientId limit $5 offset ($5-1)*$6;
> Field in question is $4
> Expected result - poor performance or clear error that dynamic sorting
> cannot be used
>
There is no bug here.
You wrote a valid query so no error should be issued. I don't see where
performance should come into this at all.
That parameters can only replace values, not identifiers, is a learning
issue that one just needs to usually encounter and take into memory. There
is no substitute for experimentation and validating ones queries. Quite
few problematic queries will execute just fine but give unexpected results.
David J.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-06-07 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-06-07 14:30 BUG #15839: Using text field for sorting in prepared query leads to wrong result PG Bug reporting form <noreply@postgresql.org>
2019-06-07 16:06 ` David G. Johnston <david.g.johnston@gmail.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