I am using node pg client, and I have a table
create table test(
id uuid not null constraint transactions_pkey primary key,
name varchar(255),
test_id uuid
);
I am trying to update test_id to NULL but I am unable to do so programmatically.
Here is my update query
dbo.query('UPDATE test SET test_id = $1 WHERE id = $2',['null','f2aasced-5633-419c-95d3-3868dd3c9c53'])
It gives me an error
error: invalid input syntax for type uuid: "NULL"
You just try to insert string 'null' into uuid column. Try
dbo.query('UPDATE test SET test_id = $1 WHERE id = $2',[null,'f2aasced-5633-419c-95d3-3868dd3c9c53'])