我正在使用 PostgreSQL 9.4 数据库。在我的bo_lesson
表中,我有一个类型的metadata
字段jsonb
。
Column | Type | Modifiers |
---------------+--------------------------------+---------------------------------|
id | integer | not null |
level | integer | |
slug | text | not null |
description | text | |
external_link | character varying(255) | default NULL::character varying |
metadata | jsonb | |
name | character varying(255) | not null |
created_at | timestamp(0) without time zone | not null |
updated_at | timestamp(0) without time zone | not null |
status | character varying(45) | not null |
但是当我执行这个查询
INSERT INTO bo_lesson (id, level, slug, description, external_link, metadata, name,
created_at, updated_at, status)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
parameters: $1 = '4', $2 = '1', $3 = 'education-3', $4 = NULL, $5 = NULL,
$6 = '"what ever [ i need }} \""', $7 = 'education',
$8 = '2015-07-30 14:33:01', $9 = '2015-07-30 14:33:01', $10 = 'draft'
该行已正确插入。
id | level | slug | description | external_link | metadata | name | created_at | updated_at | status
----+-------+-------------+-------------+---------------+----------------------------+-----------+---------------------+---------------------+--------
4 | 1 | education-3 | | | "what ever [ i need }} \"" | education | 2015-07-30 14:33:01 | 2015-07-30 14:33:01 | draft
该jsonb
字段尚未对插入的内容进行任何验证。我读过它应该这样做。我错过了配置选项吗?