Re: [SQL] Cast on character columns in views

2007-09-04 Thread Tom Lane
Richard Broersma Jr <[EMAIL PROTECTED]> writes: > --- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote: >> But when I open a query tool window and do: >> SELECT * FROM view1; >> Now, again type1 column returns as bpchar. > This might be a good question to ask on the PGAdmin mailing list or even try

Re: [SQL] Cast on character columns in views

2007-09-04 Thread Richard Broersma Jr
--- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote: > Ugh, I'm totally crazy with this views > I'm using pgadmin with postgres, when I clink on "view the data of > selected object" button all works fine. > But when I open a query tool window and do: > > SELECT * FROM view1; > Now, again type1 co

Re: [SQL] Cast on character columns in views

2007-09-04 Thread Richard Broersma Jr
--- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote: > When I drop the view first , and then create again the view (in a > separated transaction), now the command works! (this is a bug?) Well according to the manual, it is working as it is intended to work: http://www.postgresql.org/docs/8.2/intera

Re: [SQL] Cast on character columns in views

2007-09-04 Thread Luiz K. Matsumura
Luiz K. Matsumura wrote: Richard Broersma Jr wrote: --- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote: CREATE VIEW view1( id, col1, type1, type2) AS SELECT table1.id, table1.col1, CAST( table2.type1 AS CHARACTER( 3 )), NULL FROM table1 JOIN table2 ON table2.fk_tabl

Re: [SQL] Cast on character columns in views

2007-09-03 Thread Luiz K. Matsumura
Richard Broersma Jr wrote: --- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote: CREATE VIEW view1( id, col1, type1, type2) AS SELECT table1.id, table1.col1, CAST( table2.type1 AS CHARACTER( 3 )), NULL FROM table1 JOIN table2 ON table2.fk_table1 = table1.id UNION ALL SE

Re: [SQL] Cast on character columns in views

2007-09-03 Thread Richard Broersma Jr
--- "Luiz K. Matsumura" <[EMAIL PROTECTED]> wrote: > CREATE VIEW view1( id, col1, type1, type2) AS > SELECT table1.id, >table1.col1, >CAST( table2.type1 AS CHARACTER( 3 )), >NULL > FROM table1 > JOIN table2 ON table2.fk_table1 = table1.id > UNION ALL > SELECT table1.id,

[SQL] Cast on character columns in views

2007-09-03 Thread Luiz K. Matsumura
Hello, I have a scenario like this: CREATE TABLE table1 ( id serial NOT NULL, col1 character varying(30), CONSTRAINT pk_table1 PRIMARY KEY (id) ); CREATE TABLE table2 ( fk_table1 integer, type1 character(3), id serial NOT NULL, CONSTRAINT pk_table2 PRIMARY KEY (id) ); CREATE TABLE table