As title, how can I set a table\'s column to have the default value the current year and month, in format \'YYYYMM\', like 200905 for today?
Why would you want to do this?
IMHO you should store the date as default type and if needed fetch it transforming to desired format.
You could get away with specifying column's format but with a view. I don't know other methods.
Edited:
Seriously, in my opinion, you should create a view on that a table with date type. I'm talking about something like this:
create table sample_table ( id serial primary key, timestamp date);
and than
create view v_example_table as select id, to_char(date, 'yyyymmmm');
And use v_example_table in your application.