Reputation: 93
Is there a difference between default values of column in PostgreSQL? Whether this is important?
state character varying(255) DEFAULT NULL
and
state character varying(255) DEFAULT NULL::character varying
Upvotes: 9
Views: 10696
Reputation: 658162
There is no effective difference in the presented example in a standard installation.
Without explicit cast, NULL
of data type unknown
will be coerced to varchar
in an assignment cast automatically. See:
In other situations, where the type cannot be derived from context, you may need to cast explicitly - to tell Postgres the intended type of the value. This is rarely the case, though.
Upvotes: 9