VIEWs and TEMP tables problem

Поиск
Список
Период
Сортировка
От Antal Attila
Тема VIEWs and TEMP tables problem
Дата
Msg-id 43F4617E.9060708@ritek.hu
обсуждение исходный текст
Ответы Re: VIEWs and TEMP tables problem  (Richard Huxton <dev@archonet.com>)
Re: VIEWs and TEMP tables problem  (Markus Schaber <schabi@logix-tt.com>)
Список pgsql-sql
Hi!

I found a problem with the views in PostgreSQL if I want to use 
temporary tables in it.  See the next case!

CREATE TABLE a(...., code INT4,...);
INSERT INTO a(...,code,...) VALUES (...,23,...);
CREATE TABLE actual_code(code INT4);

If I execute the next query, the result is empty.   SELECT * FROM actual_code;

CREATE VIEW a_view AS SELECT * FROM a JOIN actual_code AC ON (a.code = 
AC.code);

CREATE TEMP TABLE actual_code AS SELECT 23::INT4 AS code;

If I execute the next query, the result contains exactly one row (code: 
23). This is perfect.   SELECT * FROM actual_code;

After it if I compare the the next two queries, there will be 
differences in the results.
1) SELECT * FROM a JOIN actual_code AC ON (a.code = AC.code);  (Result 
has one row!)2) SELECT * FROM a_view; (Result is empty!)

In my opinion this queries should be equivalent with same results.
The problem is that the view use the original permanent table, but the 
1) query use the temporary actual_code table.
I read the temporally table definition in the documentation 
(http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html) 
and I concluded it should be working.

Is it BUG, or FEATURE? Has anybody got good ideas for solve this problem?

This construction came to my mind, because I tried to solve my another 
question: 
http://groups.google.co.hu/group/pgsql.performance/browse_thread/thread/c7aec005f4a1f3eb/83fa0053cad33dea

Thanks your ideas!
Regards,
Antal Attila


В списке pgsql-sql по дате отправления:

Предыдущее
От: Ragnar
Дата:
Сообщение: Re: to count no of columns in a table
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: VIEWs and TEMP tables problem