On Wed, 20 Feb 2002, Rod Taylor wrote:
> According to the system table documentation
> http://developer.postgresql.org/docs/postgres/catalog-pg-type.html the
> typdefault information is to be copied from the pg_type value to the
> table value when the default specified is NULL or a default is not
> specified.
>
> The below shows that it's not to be true.
>
>
> junk=# update pg_type set typdefault = 3 where typname = 'int2';
> UPDATE 1
> junk=# create table example (col1 int2);
> CREATE
> junk=# \d example
> Table "example"
> Column | Type | Modifiers
> --------+----------+-----------
> col1 | smallint |
Seems to work for me :)
insert into example default values;
select * from example;
col1
------ 3
It doesn't show up in \d, but it is the default. I'd
also say this makes sense/is right since the type's default
is 3 and you don't have a default on the table.