Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

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

From: Gregory Stark <stark(at)enterprisedb.com>
Date: Fri Sep 28 2007 - 14:04:25 EDT


"Nico Sabbi" <nsabbi@officinedigitali.it> writes:

> nb1=# select r.a from (select row(tab1.*)::tab1 as r from tab1)x;
> ERROR: missing FROM-clause entry for table "r"
> LINE 1: select r.a from (select row(tab1.*)::tab1 as r from tab1)x;
> ^
> I tried many variations (including casting x as tab1) obtaining only syntax
> errors.

r.a would be the column "a" in the table named "r", but the only table in the FROM list is "x". So you have to use a workaround to make it clear to the parser that you're referring to the column "r", it would look like

SELECT (r).a from (select row(tab1.*)::tab1 as r from tab1)x;

-- 
  Gregory Stark
  EnterpriseDB          
http://www.enterprisedb.com

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               
http://archives.postgresql.org/
Received on Fri Sep 28 14:07:44 2007

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


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