Need to insert null value to field with uuid
type without NOT NULL specification (not primary key).
When I try insert '', this return:
ERROR: invalid input syntax for uuid: ""
When I try insert null, this return:
ERROR: null value in column "uuid" violates not-null constraint
How to do it?
psql 9.3.5
SQL:
INSERT INTO inv_location (address_id)
VALUES (null)
In Postgres use uuid_nil()
function to simulate empty uuid (same as 00000000-0000-0000-0000-000000000000
)
INSERT INTO inv_location (address_id)
VALUES (uuid_nil())
You might need to have uuid extension (not sure), if you do, run this (only once):
create extension if not exists "uuid-ossp";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With