Hello, I have the following question about the Postgres optimizer.
I have two functions: CREATE OR REPLACE FUNCTION test_func(float, OUT a bigint, OUT b bigint) RETURNS record AS 'select test_func1($1)[1],test_func1($1)[2] 'LANGUAGE SQL IMMUTABLE; and CREATE OR REPLACE FUNCTION test_func1 (float) RETURNS bigint[] AS '/home/math/skyindex/q3cube/operators/libxx.so', 'test_func1' LANGUAGE C IMMUTABLE; And I was surprised to see that in such case, when I call the function test_func, the function test_func1 is called twice. Why actually the optimizer do so ? It should not be very difficult to optimize it to one call, isn't it ? With Best Regards, Sergey PS I tested this example with including in C code of test_func1 the static counter of calls. ***************************************************** Sergey E. Koposov Max-Planck Institut fuer Astronomie Web: http://lnfm1.sai.msu.ru/~math E-mail: [EMAIL PROTECTED] ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq