Error on create view with cast numeric as decimal on postgresql -


good morning everyone!

i work postgresql. well, need create views numeric columns stay rounded 15.3 i'm encountering problem not understand.

the select work:

select cast(15.2547 decimal(15,3)) quantidade_medida_estatistica 

the view not working:

create or replace view teste select cast(15.2547 decimal(15,3)) quantidade_medida_estatistica 

error:

error: can not change data type of column view "quantidade_medida_estatistica" of numeric (15,4) numeric (15,3)

thanks!

this known "bug" in postgres, can read here.

create or replace view not same dropping view , re-creating it. in case existing columns in view need same, described in documentation:

create or replace view similar, if view of same name exists, replaced. the new query must generate same columns generated existing view query (that is, same column names in same order , same data types), may add additional columns end of list. calculations giving rise output columns may different.

you can want dropping , re-creating view.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -