Profile

outlier_lynn: (Default)
outlier_lynn

January 2015

S M T W T F S
    123
45678910
11121314151617
181920 21222324
25262728293031

Most Popular Tags

Expand Cut Tags

No cut tags
Wednesday, December 17th, 2008 11:42 am
Postgresql geeky post!

A user defined function in postgres can be defined such that it returns a set of results. That is, it can return more than one row of data as the result of a select statement. But if the function is not defined to return a set of results, it must return 0 or 1 row.

So I write a function that does not return a set. I call the function and get two rows. While the data in each row fulfills the criteria, it isn't suppose to happen. I have spent the morning trying to find out how it could happen. Postgres should have thrown an exception to complain about it.

Well. My function only returns one row. But it ran twice behind the scenes and returned the combined outputs. It only looked like it returned more than one row.

I have been searching on google and I have searched the postgres documentation. I know that must be a known thing about how postgres works, but I can't find it. I intend to keep looking.