http://www.perlmonks.org?node_id=969113


in reply to DBI weirdness: Arrays as strings.

Yeah, there is no weirdness here. Parentheses make a regular select-list into a ROW-constructor (see the FM: "The key word ROW is optional when there is more than one expression in the list." ):

So it is:

testdb=# select x,y,z from (values ('abc', 'def', 'ghi')) as f(x,y,z); x | y | z -----+-----+----- abc | def | ghi (1 row)

but with parentheses:

testdb=# select (x,y,z) from (values ('abc', 'def', 'ghi')) as f(x,y,z +); row --------------- (abc,def,ghi) (1 row) -- also: -- "The key word ROW is optional when there is more than one expressio +n in the list." -- testdb=# select (x,y,z) = row(x,y,z) from (values ('abc', 'def', 'ghi')) as f(x,y,z); ?column? ---------- t (1 row)

(latest postgresql 9.1.3.)