Re: Re: very simple: How can I multiply tables? - Mailing list pgsql-general

From Mikhail V. Majorov
Subject Re: Re: very simple: How can I multiply tables?
Date
Msg-id 3A8AB0B1.8BDD77CC@ttn.ru
Whole thread Raw
In response to very simple: How can I multiply tables?  ("Mikhail V. Majorov" <mik@ttn.ru>)
List pgsql-general
Holger Klawitter wrote:
>
> Yes, very simple!
>
> > How can I multiply tables using SELECT?
>
> select * from tbl1, tbl2;

I think so. But in real I have some problem with empty table.
Please, look at my example.

ttn=# create table t3 (id int4, surname text);
CREATE
ttn=# create table t2 (dt int4);
CREATE
ttn=# insert into t2 values ('4');
INSERT 34461 1
ttn=# insert into t2 values ('56');
INSERT 34462 1
ttn=# select * from t2,t3;
 dt | id | surname
----+----+---------
(0 rows)

ttn=#

As I know theory I must see this:

 dt | id | surname
----+----+---------
4    null    null
56    null    null

Result is change when I insert data in t3.

ttn=# insert into t3 values ('100', 'test');
INSERT 34463 1
ttn=# insert into t3 values ('101', 'test2');
INSERT 34464 1
ttn=# select * from t2,t3;
 dt | id  | surname
----+-----+---------
  4 | 100 | test
 56 | 100 | test
  4 | 101 | test2
 56 | 101 | test2
(4 rows)

ttn=#

Is it bug or normal?

Best regards,
Mik.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Crash-me of PostgreSQL
Next
From: "Mikhail V. Majorov"
Date:
Subject: Re: very simple: How can I multiply tables?