Re: Default order of select datname from pg_database - Mailing list pgsql-admin

From Tom Lane
Subject Re: Default order of select datname from pg_database
Date
Msg-id 24744.1397920655@sss.pgh.pa.us
Whole thread Raw
In response to Default order of select datname from pg_database  (Elías David <elias.moreno.tec@gmail.com>)
Responses Re: Default order of select datname from pg_database  (David G Johnston <david.g.johnston@gmail.com>)
Re: Default order of select datname from pg_database  (Elías David <elias.moreno.tec@gmail.com>)
List pgsql-admin
=?UTF-8?B?RWzDrWFzIERhdmlk?= <elias.moreno.tec@gmail.com> writes:
> By any change, does the following query have an "order by" by default when
> omitted?:

> select datname from pg_database;

No.  No SQL query ever has a "default" order by.

> I executed that query against one of my servers and while looking at the
> names it seems complety random, the order is always the same, for instance:

An unqualified query is typically going to result in a sequential scan
of the table, so what you're seeing is the current physical order of the
tuples.  This might change after adding/deleting/changing the properties
of a database.

            regards, tom lane


pgsql-admin by date:

Previous
From: Jason Mathis
Date:
Subject: Re: Default order of select datname from pg_database
Next
From: David G Johnston
Date:
Subject: Re: Default order of select datname from pg_database