OSSP CVS Repository

ossp - Ticket #163
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Attach]  [Edit]  [History

Ticket 163: pgsql unable to insert NULL into uuid colums as DEFAULT values

Hi, trying to insert a new row into a table that has a uuid column that is allowed to be NULL without an explicit value for the NULL column (as in using DEFAULT), fails.

An example that first shows the table definition, then the failing statement followed by the explicit insert statement that tries the same with DEFAULT and finally the explicit insert that works:

  simon=# \d bar
      Table "public.bar"
   Column | Type | Modifiers
  --------+------+-----------
   foo    | uuid |
   data   | text | not null
  Foreign-key constraints:
      "bar_foo_fkey" FOREIGN KEY (foo) REFERENCES foo(id)

  simon=# insert into bar (data) values ('bla');
  ERROR:  invalid UUID string length 7 (expected 36)
  simon=# insert into bar (foo, data) values (DEFAULT, 'bar');
  ERROR:  invalid UUID string length 7 (expected 36)
  simon=# insert into bar (foo, data) values (NULL, 'bla');
  INSERT 0 1

No idea or patch on how to solve it yet, but at least i wanted to file a ticket so others have a chance to come up with a possible fix.

[Add remarks]

Remarks:

Properties:

Type: code           Version: 1.6.0 
Status: new          Created: 2007-Nov-14 10:59
Severity:          Last Change: 2007-Nov-14 10:59
Priority:          Subsystem: uuid 
Assigned To: rse           Derived From:  
Creator: anonymous 

CVSTrac 2.0.1