shenodaguirguis commented on pull request #2496: URL: https://github.com/apache/iceberg/pull/2496#issuecomment-1041033300
> From the discussion with @RussellSpitzer, I think some of those statements are in conflict with the SQL spec. Here's Postgres behavior (verified by SQLFiddle): > > ```sql > create table default_test (id int); > insert into default_test values (1), (2); > alter table default_test add column data int default 0; > alter table default_test alter column data set default 1000; > insert into default_test (id) values (3); > insert into default_test values (4, null); > alter table default_test alter column data set default 2000; > ``` > > ```sql > select * from default_test; > ``` > > ``` > id | data > -- | -- > 1 | 0 > 2 | 0 > 3 | 1000 > 4 | (null) > ``` This is interesting @rdblue! Hive on the other hand, does not seem to materialize the default value upon schema evolution. Oracle 10g behaves like PostgreSql, but a performance enhancement (referred to as fast column update) in Oracle 11g, the default value lives in the schema definition and not materialized. So, this seems to me an implementation details. I checked [SQL 1992 (11.5 default clause > 2)](https://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt), and it states that default value is driven from the `<column descriptor>` , if not, then from the `range`'s default value, o.w., it is `null` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
