join functions
От | Zotov |
---|---|
Тема | join functions |
Дата | |
Msg-id | 4D23B76A.5090402@oe-it.ru обсуждение исходный текст |
Ответы |
Re: join functions
Re: join functions |
Список | pgsql-hackers |
Hello, Hackers!<br /> We have a project developed at Interbase and Firebird.<br /> Now we try use PostgreSQL and have someproblem<br /><br /> Why doesn`t work this query?<br /> select table1.field1, func1.field2 from table1 left outer joinfunc1(<font color="#ff0000">table1.field1</font>) on true where func1.field3 in (20, 100);<br /><br /> If i have otherthan LEFT OUTER JOIN I can understand why <br /> ERROR: invalid reference to FROM-clause entry for table "table1"<br/><br /> but why here? <br /> for each row of table1 just evaluate func1(table1.field1)<br /><br /> To reproduceexec this script:<br /><br /> drop table if exists table1;<br /> create table table1(field1 integer);<br /> createor replace function func1(inputparam integer) <br /> returns table(field1 integer, field2 integer, field3 integer)as <br /> $BODY$<br /> begin <br /> field1 := inputparam * 2;<br /> field2 := inputparam * 3;<br /> field3:= inputparam * 4;<br /> return next;<br /><br /> inputparam := inputparam * inputparam;<br /> field1 := inputparam* 2;<br /> field2 := inputparam * 3;<br /> field3 := inputparam * 4;<br /> return next;<br /> end;<br />$BODY$<br /> LANGUAGE plpgsql VOLATILE;<br /><br /> insert into table1 values(5);<br /><br /> --select table1.field1, func1.field2from table1 left outer join func1(table1.field1) on true where func1.field3 in (20, 100);<br /> select table1.field1,func1.field2 from table1 left outer join func1(5) on true where func1.field3 in (20, 100);<br /><br /><br />Please help resolve this problem!<br /><br /><pre class="moz-signature" cols="72">-- С уважением, Зотов Роман Владимирович руководитель Отдела инструментария ЗАО "НПО Консультант" г.Иваново, ул. Палехская, д. 10 тел./факс: (4932) 41-01-21 mailto: <a class="moz-txt-link-abbreviated" href="mailto:zotov@oe-it.ru">zotov@oe-it.ru</a></pre>
В списке pgsql-hackers по дате отправления: