Offered up because I have no explanation, and curiosity overwhelms me:
I was attempting to create a table from a SELECT statement against
another table:
create table foo
as selecta,f(b)
from xxx;
The function f() attempts to make a unique value based on its argument
(it's actually a "username" constructor, making "jboes" out of "Jeff
Boes"). The odd thing is that function f() also looks into the table
"foo" to see if the value it's constructing is truly unique; if it is
not, it tacks on a "1", "2", etc. until it gets a unique value.
The odd behavior is as follows: with a "CREATE TABLE ... AS SELECT"
statement, the function never found duplicate values, so I ended up with
f(a) = f(a') = f(a''), etc. I tried defining the function as STABLE,
then VOLATILE, without success. But if I changed to create the table
first, and then do "INSERT INTO ... SELECT", the function worked properly.