简体   繁体   English

尝试插入SQL Dump时在列名或附近的语法错误

[英]syntax error at or near column name while trying insert sql dump

I am trying to insert a table specific sql dump into a database (psql). 我正在尝试将表特定的sql转储插入数据库(psql)。 There is a table called "templates" which already has some values, and trying to dump new values. 有一个称为“模板”的表,该表已经具有一些值,并尝试转储新值。 The sql file looks like below. sql文件如下所示。

INSERT INTO templates (id, name, created_at, updated_at, template_path, page_type, container_type, entity_type, entity_id, asset_group_id, data_proxy_id, publisher_id, status, default, image_url_path, sequence) VALUES ('434', 'Full Width Image', '2018-10-25 11:13:35.695256', '2018-11-23 07:26:25.663427', '/templates/full_width_landscape', null, null, null, null, null, null, '655', 'true', 'true', 'template1', 1);

When I am trying to insert this sql file by doing 当我尝试通过执行此SQL文件插入

\i sql file path

I am getting the following error: 我收到以下错误:

ERROR:  syntax error at or near "default"
LINE 1: ...et_group_id, data_proxy_id, publisher_id, status, default, i...

Can someone tell what's wrong here ? 有人可以告诉我这是怎么回事吗?

you have use use double quote for reserve word as a column name 您已经使用双引号将保留字用作列名

    INSERT INTO templates (id, name, created_at, updated_at,
 template_path, page_type, container_type,
 entity_type, entity_id, asset_group_id, 
data_proxy_id, publisher_id, status, "default", 
image_url_path, sequence) VALUES ('434', 'Full Width Image', '2018-10-25 11:13:35.695256', '2018-11-23 07:26:25.663427', '/templates/full_width_landscape', null, null, null, null, null, null, '655', 'true', 'true', 'template1', 1);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM