Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

[GENERAL] row->ARRAY or row->table casting?

From: Nico Sabbi <nsabbi(at)officinedigitali.it>
Date: Fri Sep 28 2007 - 11:37:38 EDT


Hi,
is there any way to cast a generic row to an array or to a table type?

The example is trivial, but it explains what I'm trying to do:

nb1=# select * from tab1;
 a | t
---+---

 1 | a
 2 | b
 3 | c

(3 rows)

nb1=# select r from (select row(tab1.*) as r from tab1)x;

   r



(1,a)
(2,b)
(3,c)

(3 rows)

nb1=# select r[1] from (select row(tab1.*) as r from tab1)x; ERROR: cannot subscript type record because it is not an array

nb1=# select (r::tab1).a from (select row(tab1.*) as r from tab1)x; ERROR: cannot cast type record to tab1

The real use case is much more complex than this example of course :)

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match
Received on Fri Sep 28 11:49:13 2007
Do you need help?X

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 11:57:12 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library