Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: DBI weirdness: Arrays as strings. (ROW constructor)

by erix (Prior)
on May 06, 2012 at 05:51 UTC ( [id://969113]=note: print w/replies, xml ) Need Help??


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.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://969113]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-19 02:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found