Re: Default order of select datname from pg_database

Поиск
Список
Период
Сортировка
От Elías David
Тема Re: Default order of select datname from pg_database
Дата
Msg-id CANNE3r0-urWBDryg--NQSP7Bt_AAN5n0ug+PTrAtxFUadikMxQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Default order of select datname from pg_database  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin

Ah... I see, that clarifies things. Thank you all for your responses!

All started because I looked a script that is used in our company to backup databases and it seemed odd that the query didn't use an order by sentence which would be helpful, that way I could anticipate when a particular database is going to be backed up, it's easy to fix though so no issues there.

Again thank you all

Best regards

On Apr 19, 2014 10:47 AM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
Elías David <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 по дате отправления:

Предыдущее
От: David G Johnston
Дата:
Сообщение: Re: Default order of select datname from pg_database
Следующее
От: Eric Jankowski
Дата:
Сообщение: database system was not properly shut down