Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Default value of column not respecting character length or domain restraints.



It seems I can feed a default value to a domain that won't fit in the
underlying base type. I have the domain html_colors as so:

CREATE DOMAIN html_color AS char(7) CHECK (VALUE ~ '^#[A-Fa-f0-9]{6}$');

I then defined a column of html_colors as so:
ALTER TABLE users ALTER COLUMN profile_color SET DEFAULT '#FFFFRFF';

This worked fine and I didn't notice it until I added arecord to the
users table and got the error:
ERROR: value too long for type character(7).

This behavior seems undesirable to me. Is this a known bug or is there
a reason for this?

Regards,
Justin Dearing



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group