On Sat, Jun 18, 2005 at 10:03:38PM +1000, John Hansen wrote: > > There is a workaround tho, so should be fixable: > > SELECT (a.b).* FROM (SELECT ('1:2:3:4:5'::text::my_type) AS b) AS a; > > Or am I missing something?
I don't know enough about PostgreSQL internals so I'll have to defer to the developers. But here's a case where the above workaround doesn't work -- in my tests, the cast function is called once per column per row, or ten times: CREATE TABLE foo (t text); INSERT INTO foo VALUES ('1:2:3:4:5'); INSERT INTO foo VALUES ('6:7:8:9:10'); SELECT (a.b).* FROM (SELECT t::my_type AS b FROM foo) AS a; What do you get? Can you think of a workaround for this case? Maybe one of the developers can comment on why your example calls the function only once and mine calls it multiple times per row, even though they look similar. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend