Search Postgresql Archives

Constraint: string length must be 32 chars

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm trying to create a table, where md5 strings will serve as primary keys.
So I'd like to add a constraing that the key length should be 32 chars long
(and contain [a-fA-F0-9] only):

create table gps (
id varchar(32) primary key CONSTRAINT char_length(id)==32,
stamp timestamp DEFAULT current_timestamp,
pos point);

But it fails:

ERROR:  syntax error at or near "("
LINE 2: id varchar(32) primary key CONSTRAINT char_length(id)==32,
                                                         ^
Does anybody please know what's wrong here?

Thank you
Alex

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux