pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #13811: Default ordering colums
3+ messages / 3 participants
[nested] [flat]
* BUG #13811: Default ordering colums
@ 2015-12-10 12:52 exru@mail.ru
0 siblings, 2 replies; 3+ messages in thread
From: exru@mail.ru @ 2015-12-10 12:52 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 13811
Logged by: Vyacheslav
Email address: exru@mail.ru
PostgreSQL version: 9.4.5
Operating system: Debian 8.1
Description:
--1) create table and make batch insert of values
CREATE TABLE auction
(
id serial NOT NULL primary key,
name text,
type smallint,
client_id integer,
description text,
category_id integer,
dt_start timestamp(0) without time zone,
dt_end timestamp(0) without time zone,
status smallint DEFAULT 1
);
INSERT INTO "auction" ("id", "name", "type", "client_id", "description",
"status", "category_id", "dt_start", "dt_end") VALUES (0, 'Аукцион1', 1, 1,
'Аукцион0', -1, 5, '2015-12-10 15:38:00', NULL), (1, 'Аукцион1', -1, 1,
'Аукцион1', 0, 5, '2015-12-10 15:38:00', NULL), (2, 'Аукцион2', 1, 1,
'Аукцион2', 1, 5, '2015-12-10 15:38:00', NULL), (3, 'Аукцион3', 1, 1,
'Аукцион3', 1, 5, '2015-12-10 15:38:00', NULL), (4, 'Аукцион4', 1, 1,
'Аукцион4', 3, 7, '2015-12-10 15:38:00', NULL), (5, 'Аукцион5', 1, 1,
'Аукцион5', 4, 5, '2015-12-10 15:38:00', NULL), (6, 'Аукцион6', 1, 1,
'Аукцион6', 5, 6, '2015-12-10 15:38:00', NULL), (7, 'Аукцион7', -1, 1,
'Аукцион7', 6, 6, '2015-12-10 15:38:00', NULL), (8, 'Аукцион7', 1, 1,
'Аукцион7', 7, 7, '2015-12-10 15:38:00', NULL);
2) then i maked a select (SELECT * FROM auction;) i've get the next rows
with orders:
0;"Аукцион1";1;1;"Аукцион0";5;"2015-12-10 15:38:00";"";-1
1;"Аукцион1";-1;1;"Аукцион1";5;"2015-12-10 15:38:00";"";0
2;"Аукцион2";1;1;"Аукцион2";5;"2015-12-10 15:38:00";"";1
3;"Аукцион3";1;1;"Аукцион3";5;"2015-12-10 15:38:00";"";1
4;"Аукцион4";1;1;"Аукцион4";7;"2015-12-10 15:38:00";"";3
5;"Аукцион5";1;1;"Аукцион5";5;"2015-12-10 15:38:00";"";4
6;"Аукцион6";1;1;"Аукцион6";6;"2015-12-10 15:38:00";"";5
7;"Аукцион7";-1;1;"Аукцион7";6;"2015-12-10 15:38:00";"";6
8;"Аукцион7";1;1;"Аукцион7";7;"2015-12-10 15:38:00";"";7
3) the make the:
UPDATE "auction" SET "type"=1, "client_id"=1, "dt_start"='2015-12-10
15:38:00', "status"=-1 WHERE "id"=0; //data in the raw was not changed bat
the (SELECT * FROM auction;) give me the next order of rows:
1;"Аукцион1";-1;1;"Аукцион1";5;"2015-12-10 15:38:00";"";0
2;"Аукцион2";1;1;"Аукцион2";5;"2015-12-10 15:38:00";"";1
3;"Аукцион3";1;1;"Аукцион3";5;"2015-12-10 15:38:00";"";1
4;"Аукцион4";1;1;"Аукцион4";7;"2015-12-10 15:38:00";"";3
5;"Аукцион5";1;1;"Аукцион5";5;"2015-12-10 15:38:00";"";4
6;"Аукцион6";1;1;"Аукцион6";6;"2015-12-10 15:38:00";"";5
7;"Аукцион7";-1;1;"Аукцион7";6;"2015-12-10 15:38:00";"";6
8;"Аукцион7";1;1;"Аукцион7";7;"2015-12-10 15:38:00";"";7
0;"Аукцион1";1;1;"Аукцион0";5;"2015-12-10 15:38:00";"";-1
4) There is no any orders by or any changes in sequences. Why do that???
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #13811: Default ordering colums
@ 2015-12-10 20:52 John R Pierce <pierce@hogranch.com>
parent: exru@mail.ru
1 sibling, 0 replies; 3+ messages in thread
From: John R Pierce @ 2015-12-10 20:52 UTC (permalink / raw)
To: pgsql-bugs
On 12/10/2015 4:52 AM, exru@mail.ru wrote:
> 4) There is no any orders by or any changes in sequences. Why do that???
tables represent sets, unordered lists. if you want query results in a
specific order, use an ORDER BY clause on your SELECT
--
john r pierce, recycling bits in santa cruz
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #13811: Default ordering colums
@ 2015-12-10 20:59 David G. Johnston <david.g.johnston@gmail.com>
parent: exru@mail.ru
1 sibling, 0 replies; 3+ messages in thread
From: David G. Johnston @ 2015-12-10 20:59 UTC (permalink / raw)
To: exru@mail.ru; +Cc: pgsql-bugs
On Thu, Dec 10, 2015 at 5:52 AM, <exru@mail.ru> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 13811
> Logged by: Vyacheslav
> Email address: exru@mail.ru
> PostgreSQL version: 9.4.5
> Operating system: Debian 8.1
> Description:
>
>
> 0;"Аукцион1";1;1;"Аукцион0";5;"2015-12-10 15:38:00";"";-1
> 1;"Аукцион1";-1;1;"Аукцион1";5;"2015-12-10 15:38:00";"";0
> 2;"Аукцион2";1;1;"Аукцион2";5;"2015-12-10 15:38:00";"";1
> 3;"Аукцион3";1;1;"Аукцион3";5;"2015-12-10 15:38:00";"";1
> 4;"Аукцион4";1;1;"Аукцион4";7;"2015-12-10 15:38:00";"";3
> 5;"Аукцион5";1;1;"Аукцион5";5;"2015-12-10 15:38:00";"";4
> 6;"Аукцион6";1;1;"Аукцион6";6;"2015-12-10 15:38:00";"";5
> 7;"Аукцион7";-1;1;"Аукцион7";6;"2015-12-10 15:38:00";"";6
> 8;"Аукцион7";1;1;"Аукцион7";7;"2015-12-10 15:38:00";"";7
>
> <do stuff here>
>
>
> 1;"Аукцион1";-1;1;"Аукцион1";5;"2015-12-10 15:38:00";"";0
> 2;"Аукцион2";1;1;"Аукцион2";5;"2015-12-10 15:38:00";"";1
> 3;"Аукцион3";1;1;"Аукцион3";5;"2015-12-10 15:38:00";"";1
> 4;"Аукцион4";1;1;"Аукцион4";7;"2015-12-10 15:38:00";"";3
> 5;"Аукцион5";1;1;"Аукцион5";5;"2015-12-10 15:38:00";"";4
> 6;"Аукцион6";1;1;"Аукцион6";6;"2015-12-10 15:38:00";"";5
> 7;"Аукцион7";-1;1;"Аукцион7";6;"2015-12-10 15:38:00";"";6
> 8;"Аукцион7";1;1;"Аукцион7";7;"2015-12-10 15:38:00";"";7
> 0;"Аукцион1";1;1;"Аукцион0";5;"2015-12-10 15:38:00";"";-1
>
>
> 4) There is no any orders by or any changes in sequences. Why do that?
>
Why questions are not typically bugs, and this one definitely is not, but
anyway...
Q: Why does the order change?
A: Because the executor wasn't told to care about order in the query and
this is what came through naturally.
Also, updating a row, even if you do not change the actual values of the
any of columns, still causes the system to perform a delete/insert pair (in
MVCC terms). The row with ID 0 in the first result is physically different
than the one returned in the second result.
David J.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2015-12-10 20:59 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-12-10 12:52 BUG #13811: Default ordering colums exru@mail.ru
2015-12-10 20:52 ` John R Pierce <pierce@hogranch.com>
2015-12-10 20:59 ` 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