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

From Jason Mathis
Subject Re: Default order of select datname from pg_database
Date
Msg-id A26D6648-3548-4AD1-A09C-83F69E1E4EA4@redzonesoftware.com
Whole thread Raw
In response to Default order of select datname from pg_database  (Elías David <elias.moreno.tec@gmail.com>)
List pgsql-admin
Hi David,

Ordering can never be assumed in SQL. If you want a particular order then you need an order by.

Hope that hopes!

Jason

> On Apr 19, 2014, at 1:19 AM, Elías David <elias.moreno.tec@gmail.com> wrote:
>
> Hi all,
>
> By any change, does the following query have an "order by" by default when omitted?:
>
> select datname from pg_database;
>
> I know you could pass and ORDER BY datname or similar but what I don't know is if by default there's some kind of
sortwhen the order by is omitted. 
>
> I executed that query against one of my servers and while looking at the names it seems complety random, the order is
alwaysthe same, for instance: 
>
> web2
> template0
> asdf
> basic
> postgres
> web3
> .....
>
> Does anybody know?
>
> Thanks in advance!
>
> --
> Elías David.

--


This transmission contains confidential and privileged information intended
solely for the party identified above. If you receive this message in
error, you must not use it or convey it to others. Please destroy it
immediately and contact the sender at (303) 386-3955 or by return e-mail to
the sender.


pgsql-admin by date:

Previous
From: Elías David
Date:
Subject: Default order of select datname from pg_database
Next
From: Tom Lane
Date:
Subject: Re: Default order of select datname from pg_database