簡體   English   中英

無法在uuid類型的列中設置NULL值,在使用Node JS的Postgresql中該值可以為空

[英]Unable to set NULL value in a column with type uuid which is nullable in Postgresql using Node JS

我正在使用節點pg客戶端,並且有一個表

create table test(
   id uuid not null constraint transactions_pkey primary key,
   name varchar(255),
   test_id uuid
);

我正在嘗試將test_id更新為NULL,但無法以編程方式進行。

這是我的更新查詢

dbo.query('UPDATE test SET test_id = $1 WHERE id = $2',['null','f2aasced-5633-419c-95d3-3868dd3c9c53'])

它給我一個錯誤

error: invalid input syntax for type uuid: "NULL"

您只需嘗試將字符串“ null”插入uuid列。 嘗試

dbo.query('UPDATE test SET test_id = $1 WHERE id = $2',[null,'f2aasced-5633-419c-95d3-3868dd3c9c53'])

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM