![](/img/trans.png)
[英]Inserting data into PostgreSQL jsonb column with Daper.Net and NPGSQL
[英]What is the correct syntax of inserting the data inside the jsonb[] type column inside postgresql
由于我们只能在 jsonb 列中存储 json 对象数组,那么为什么要使用 jsonb[]. 我试图通过简单地将 jsonb 对象数组从 jsonb 列复制到 jsonb[] 列来将数据插入到 jsonb[] 中。 但是出现错误“格式错误的数组文字:必须引入明确指定的数组维度”。
[
{
"SchoolsCode": "",
"SchoolsName": "",
"SchoolsType": "High School",
"ErrorMessage": null,
"SchoolsDegree": "Doctoral Degree",
"BiskDocumentID": "",
"FailedAttempts": 0,
"SchoolsDegreeID": 2,
"ChecklistsHidden": "Active",
"ChecklistsStatus": "Received",
"ChecklistsSection": "Official Transcript",
"ChecklistsSubject": "High School Transcript (Bloomingdale High School)",
"SchoolMailingAddress": {
"City": "Windham",
"Region": "ME",
"Country": "United States",
"ZipCode": "",
"AddressStreet1": "406 Gray Rd",
"AddressStreet2": null
},
"SchoolsConferredDate": "2018-05-01",
"DocumentInformationID": 1,
"SchoolsAttendedToDate": "2018-07-01",
"SchoolsAttendedFromDate": "2014-04-01",
"IsSalesforceUpsertSuccess": true,
"IsStatusReceivedFromMaterialsEndpoint": true
},
{
"SchoolsCode": "",
"SchoolsName": "Bloomingdale High Scho",
"SchoolsType": "High School",
"ErrorMessage": null,
"SchoolsDegree": "Doctoral Degree",
"BiskDocumentID": "",
"FailedAttempts": 0,
"SchoolsDegreeID": 6,
"ChecklistsHidden": "Active",
"ChecklistsStatus": "Received",
"ChecklistsSection": "Official Transcript",
"ChecklistsSubject": "",
"SchoolMailingAddress": {
"City": "Windham",
"Region": "ME",
"Country": "United States",
"ZipCode": "",
"AddressStreet1": "406 Gray Rd",
"AddressStreet2": null
},
"SchoolsConferredDate": "2018-05-01",
"DocumentInformationID": 2,
"SchoolsAttendedToDate": "2018-07-01",
"SchoolsAttendedFromDate": "2014-04-01",
"IsSalesforceUpsertSuccess": true,
"IsStatusReceivedFromMaterialsEndpoint": true
},
{
"SchoolsCode": "",
"SchoolsName": "Governors State University",
"SchoolsType": "High School",
"ErrorMessage": null,
"SchoolsDegree": "Bachelor's Degree",
"BiskDocumentID": "fwafhawolef",
"FailedAttempts": 0,
"SchoolsDegreeID": 4,
"ChecklistsHidden": "Active",
"ChecklistsStatus": "Missing",
"ChecklistsSection": "Official Transcript",
"ChecklistsSubject": "High School Transcript (Bloomingdale High School)",
"SchoolMailingAddress": {
"City": "Windham",
"Region": "ME",
"Country": "United States",
"ZipCode": "04062",
"AddressStreet1": "406 Gray Rd",
"AddressStreet2": null
},
"SchoolsConferredDate": "2018-05-01",
"DocumentInformationID": 3,
"SchoolsAttendedToDate": "2018-07-01",
"SchoolsAttendedFromDate": "2014-04-01",
"IsSalesforceUpsertSuccess": true,
"IsStatusReceivedFromMaterialsEndpoint": true
}
]
试试这个: inserting-jsonb-data-in-postgresql-9-6
文档:该函数从 postgres 9.6 开始存在, funtions-jsonb-postgresql
简单插入也应该有效。 例如:
INSERT INTO orders (info)
VALUES('{ "customer": "John Doe", "items": {"product": "Beer","qty": 6}}');
如果以上不起作用,请参阅此链接,此问题与您的类似: https : //stackoverflow.com/a/48866861/11094058
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.