[pgsql-jp: 31052] Re: common sence?

SKSG it2s-ksg @ asahi-net.or.jp
2003年 9月 14日 (日) 13:22:02 JST


>加えて,PostgreSQL では,できないようですが,
>
>select distinct * from t1 where f1 is not null and f1 = '1' order by f1 union\
>select distinct * from t1 where f1 is not null adn f1 = '2' order by f1;
>
>とやって
>
>select distinct * from t1 where f1 is not null and f1 = '1' order by f1
>
>でできる中間仮想テーブルと
>
>select distinct * from t1 where f1 is not null and f1 = '2' order by f1
>
>でできる中間仮想テーブルを union してやると,
>
>  f1 | f2
>----+----
>   1 |  1
>   2 |  2
>(2 rows)
>
>のように,行
>
>  1 | 1
>
>と行
>
>  2 | 2
>
>のレコード順は保持される(常識2).

みなさんの回答どおりですが、
すごく抽象的な事をいうと、この手の表形式のデータベースは
「集合」を扱っています。集合では{a,b} も{b,a} も同じです。
中身の順序と言う概念はありません。(もともとのE.F.Codd の
思想に基づく)
要するに、レコード順には何の保証もありません。

-- 
Shoichi Kosuge



pgsql-jp メーリングリストの案内