I know I can do one column like this :
a := ARRAY(SELECT id FROM idx);
but how about more than one ?
Because if I try this :
a := ARRAY(SELECT id, p FROM idx);
I get
ERROR: subquery must return only one column
SQL state: 42601
regards
mk
Hello
2008/11/13 Marcin Krawczyk [EMAIL PROTECTED]:
I know I can do one column like this :
a := ARRAY(SELECT id FROM idx);
but how about more than one ?
Because if I try this :
a := ARRAY(SELECT id, p FROM idx);
I get
ERROR: subquery must return only one column
SQL state: 42601
you
Στις Thursday 13 November 2008 11:13:30 ο/η Marcin Krawczyk έγραψε:
I know I can do one column like this :
a := ARRAY(SELECT id FROM idx);
but how about more than one ?
Because if I try this :
a := ARRAY(SELECT id, p FROM idx);
I get
ERROR: subquery must return only one column
SQL
Pavel Stehule [EMAIL PROTECTED] writes:
2008/11/13 Marcin Krawczyk [EMAIL PROTECTED]:
Because if I try this :
a := ARRAY(SELECT id, p FROM idx);
I get
ERROR: subquery must return only one column
you can't do it directly :( now.
Sure you can, if you're using a version new enough to have
Pavel Stehule [EMAIL PROTECTED] writes:
2008/11/13 Tom Lane [EMAIL PROTECTED]:
Sure you can, if you're using a version new enough to have arrays of
composite types.
I don't expect so user use devel version ;)
My example was done in 8.3.
- and result is array of
some composite type, not
2008/11/13 Tom Lane [EMAIL PROTECTED]:
Pavel Stehule [EMAIL PROTECTED] writes:
2008/11/13 Tom Lane [EMAIL PROTECTED]:
Sure you can, if you're using a version new enough to have arrays of
composite types.
I don't expect so user use devel version ;)
My example was done in 8.3.
- and result
Pavel Stehule [EMAIL PROTECTED] writes:
2008/11/13 Tom Lane [EMAIL PROTECTED]:
My example was done in 8.3.
I tested it with error:
postgres=# select array(select row(a,b) from f);
ERROR: could not find array type for datatype record
You left out the cast to a named rowtype --- that's not
2008/11/13 Tom Lane [EMAIL PROTECTED]:
Pavel Stehule [EMAIL PROTECTED] writes:
2008/11/13 Marcin Krawczyk [EMAIL PROTECTED]:
Because if I try this :
a := ARRAY(SELECT id, p FROM idx);
I get
ERROR: subquery must return only one column
you can't do it directly :( now.
Sure you can, if
2008/11/13 Tom Lane [EMAIL PROTECTED]:
Pavel Stehule [EMAIL PROTECTED] writes:
2008/11/13 Tom Lane [EMAIL PROTECTED]:
My example was done in 8.3.
I tested it with error:
postgres=# select array(select row(a,b) from f);
ERROR: could not find array type for datatype record
You left out