Re: VIEWs and TEMP tables problem
От | Markus Schaber |
---|---|
Тема | Re: VIEWs and TEMP tables problem |
Дата | |
Msg-id | 43F46C5E.8090806@logix-tt.com обсуждение исходный текст |
Ответ на | VIEWs and TEMP tables problem (Antal Attila <atesz@ritek.hu>) |
Ответы |
Re: VIEWs and TEMP tables problem
|
Список | pgsql-sql |
Hi, Antal, Antal Attila wrote: > CREATE VIEW a_view AS SELECT * FROM a JOIN actual_code AC ON (a.code = > AC.code); Here, you bind the View to the permanent table. > CREATE TEMP TABLE actual_code AS SELECT 23::INT4 AS code; And here you create the temp table that will hide the permanent 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. I would not think so, as it states "unless they are referenced with schema-qualified names". So the permanent table is not removed, only hidden in the default (non-qualified) name space. Views don't look up the tables by name. Views bind to the table via internal ids, and this binding is strong enough to survive even a table rename, still referencing the same table. > Is it BUG, or FEATURE? Has anybody got good ideas for solve this problem? It is a feature. > 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 Maybe you try: CREATE VIEW ab_view AS SELECT a.id AS id, a.userid AS userid, a.col AS col_a,b.col AS col_b FROM a LEFT JOIN b ON (a.id = b.a_id AND a.userid=b.userid); EXPLAIN ANALYSE SELECT * FROM ab_view WHERE userid = 23 AND col_a LIKE 's%' ORDER BY col_b LIMIT 10 OFFSET10; HTH, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org
В списке pgsql-sql по дате отправления: