Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Novice > Re: why am I to...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 3104 of 3323
Post > Topic >>

Re: why am I told "subquery must return only one column"

by tgl@[EMAIL PROTECTED] (Tom Lane) May 5, 2008 at 01:01 PM

John Gunther <postgresql@[EMAIL PROTECTED]
> writes:
> and trying to create a second function mstr that calls the sub function 
> using a select statement as sub's argument:
> create function mstr(text,text) returns int as 'select sub((select 
> 5,6,7,8)::m);' language sql;

I think you want 'select sub(row(5,6,7,8)::m)'

> My question is this:
> (select 5,6,7,8)::m returns a single entity of composite type m

No, the select returns four columns, and trying to cast it after the
fact doesn't change that.  We might at some point try to sup****t the
above syntax, but I'm not in a big hurry considering that it's not
required by the SQL spec --- the row() syntax is what the spec says
you use to construct a composite value.

			regards, tom lane

-- 
Sent via pgsql-novice mailing list (pgsql-novice@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice
 




 3 Posts in Topic:
why am I told "subquery must return only one column"
postgresql@[EMAIL PROTECT  2008-05-05 10:53:31 
Re: why am I told "subquery must return only one column"
tgl@[EMAIL PROTECTED] (T  2008-05-05 13:01:04 
Re: why am I told "subquery must return only one column"
postgresql@[EMAIL PROTECT  2008-05-05 14:10:35 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 6:29:14 CST 2008.