| From: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
|---|---|
| To: | Yan Cheng CHEOK <yccheok(at)yahoo(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: default ordering of query result - are they always guarantee |
| Date: | 2010-05-19 04:42:14 |
| Message-ID: | 4BF36C26.3020400@lelarge.info |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Le 19/05/2010 05:06, Yan Cheng CHEOK a écrit :
> I have the following table :
>
> CREATE TABLE measurement_1
> (
> measurement_id serial NOT NULL,
> fk_unit_id int NOT NULL,
> "value" double precision,
> measurement_type text NOT NULL,
> measurement_unit text NOT NULL
> );
>
> When I want to retrieve the query. By default, the query result are ordered in ascending order, by using measurement_id.
>
> SELECT measurement_type, value, measurement_unit
> FROM
> measurement_1
>
> This is the default behavior I want. However, I am not sure whether this is always guarantee? Or shall I explicitly make the query in the following form?
An you're right. It's not guaranted. The only guaranted way is to use
ORDER BY your_column.
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Malm Paul | 2010-05-19 06:43:45 | metadata on a table |
| Previous Message | Yan Cheng CHEOK | 2010-05-19 03:06:56 | default ordering of query result - are they always guarantee |