Skip site navigation (1) Skip section navigation (2)

Re: minor view creation weirdness

From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: minor view creation weirdness
Date: 2003-10-03 16:55:42
Message-ID: 1065200142.24250.70.camel@camel (view raw or flat)
Thread:
Lists: pgsql-hackers
On Fri, 2003-10-03 at 00:50, Greg Stark wrote:
> 
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> 
> > >> I'd almost argue that we should change this message to an error
> > 
> > > I agree.
> > 
> > Motion proposed and seconded; any objections out there?
> 
> Uhm, doesn't the spec have anything to say about this? 
> I mean, the view sure looks like standard SQL on its face.
> 
> In any case, I would sure think there was something strange about a query
> working fine as a select but not working in a view:
> 
> slo=>  select 'foo' as a,'bar' as b;
>   a  |  b  
> -----+-----
>  foo | bar
> (1 row)
> 
> slo=> create view x as select 'foo' as a,'bar' as b;
> WARNING:  Attribute "a" has an unknown type
> 	Proceeding with relation creation anyway
> WARNING:  Attribute "b" has an unknown type
> 	Proceeding with relation creation anyway
> CREATE VIEW
> 
> slo=> select * from x;
>   a  |  b  
> -----+-----
>  foo | bar
> (1 row)
> 

or the create table case:

rms=# create table x as select 'foo' as a, 'bar' as b;
WARNING:  42P16: attribute "a" has type UNKNOWN
DETAIL:  Proceeding with relation creation anyway.
LOCATION:  CheckAttributeType, heap.c:427
WARNING:  42P16: attribute "b" has type UNKNOWN
DETAIL:  Proceeding with relation creation anyway.
LOCATION:  CheckAttributeType, heap.c:427
WARNING:  attribute "a" has type UNKNOWN
DETAIL:  Proceeding with relation creation anyway.
WARNING:  attribute "b" has type UNKNOWN
DETAIL:  Proceeding with relation creation anyway.
SELECT

rms=# select * from x;
  a  |  b  
-----+-----
 foo | bar
(1 row)

rms=# \d x
        Table "public.x"
 Column |   Type    | Modifiers 
--------+-----------+-----------
 a      | "unknown" | 
 b      | "unknown" | 


Robert Treat
-- 
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL


In response to

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2003-10-03 17:11:16
Subject: Re: back from Washington, still busy
Previous:From: Marc G. FournierDate: 2003-10-03 16:47:58
Subject: Re: Thoughts on maintaining 7.3

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group