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

Re: Cast on character columns in views

From: "Luiz K(dot) Matsumura" <luiz(at)planit(dot)com(dot)br>
To: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Cast on character columns in views
Date: 2007-09-04 06:38:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Richard Broersma Jr wrote:
> --- "Luiz K. Matsumura" <luiz(at)planit(dot)com(dot)br> wrote:
>> CREATE VIEW view1( id, col1, type1, type2) AS
>>        table1.col1,
>>        CAST( table2.type1 AS CHARACTER( 3 )),
>>        NULL
>> FROM   table1
>> JOIN   table2 ON table2.fk_table1 =
>>        table1.col1,
>>        CAST( NULL AS CHARACTER( 3 )),
>>        table3.type2
>> FROM   table1
>> JOIN   table3 ON table3.fk_table1 =;
> Would the above changes work?
> Regards,
> Richard Broersma Jr.
Hi Richard,
Your changes works ! But now I know what mistake I did:

The error is occurring because I'm doing a CREATE OR REPLACE VIEW command.
The command with null:character(3) works too.
The error is because I create a view then try to change the definition 
with the CREATE OR REPLACE VIEW command
When I drop the view first , and then create again the view (in a 
separated transaction), now the command works! (this is a bug?)
I'm using a postgres 8.2.4 on Linux.

Thanks a lot!

Luiz K. Matsumura
Plan IT Tecnologia Informática Ltda.

In response to


pgsql-sql by date

Next:From: Luiz K. MatsumuraDate: 2007-09-04 07:33:50
Subject: Re: Cast on character columns in views
Previous:From: Bryce NesbittDate: 2007-09-04 05:07:04
Subject: Re: Difference between "foo is false" and "foo=false"? Partial index on boolean.

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