首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >插入查询中的错误:语法错误在",“

插入查询中的错误:语法错误在",“
EN

Stack Overflow用户
提问于 2017-03-20 07:56:08
回答 1查看 1.8K关注 0票数 0

我的插入查询是,

代码语言:javascript
运行
复制
insert into app_library_reports  
  (app_id,adp_id,reportname,description,searchstr,command,templatename,usereporttemplate,reporttype,sentbothfiles,useprevioustime,usescheduler,cronstr,option,displaysettings,isanalyticsreport,report_columns,chart_config)
values
 (25,18,"Report_Barracuda_SpamDomain_summary","Report On Domains Sending Spam Emails","tl_tag:Barracuda_spam AND action:2","BarracudaSpam/Report_Barracuda_SpamDomain_summary.py",,,,,,,,,,,,);

表'app_library_reports‘的架构是:

代码语言:javascript
运行
复制
                                                   Table "public.app_library_reports"
      Column       |  Type   |                            Modifiers                             | Storage  | Stats target | Description
-------------------+---------+------------------------------------------------------------------+----------+--------------+-------------
 id                | integer | not null default nextval('app_library_reports_id_seq'::regclass) | plain    |              |
 app_id            | integer |                                                                  | plain    |              |
 adp_id            | integer |                                                                  | plain    |              |
 reportname        | text    |                                                                  | extended |              |
 description       | text    |                                                                  | extended |              |
 searchstr         | text    |                                                                  | extended |              |
 command           | text    |                                                                  | extended |              |
 templatename      | text    |                                                                  | extended |              |
 usereporttemplate | boolean |                                                                  | plain    |              |
 reporttype        | text    |                                                                  | extended |              |
 sentbothfiles     | text    |                                                                  | extended |              |
 useprevioustime   | text    |                                                                  | extended |              |
 usescheduler      | text    |                                                                  | extended |              |
 cronstr           | text    |                                                                  | extended |              |
 option            | text    |                                                                  | extended |              |
 displaysettings   | text    |                                                                  | extended |              |
 isanalyticsreport | boolean |                                                                  | plain    |              |
 report_columns    | json    |                                                                  | extended |              |
 chart_config      | json    |                                                                  | extended |              |
Indexes:
    "app_library_reports_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
    "app_library_reports_adp_id_fkey" FOREIGN KEY (adp_id) REFERENCES app_library_adapter(id)
    "app_library_reports_app_id_fkey" FOREIGN KEY (app_id) REFERENCES app_library_definition(id)

当我执行insert查询时,它会产生错误: error :语法错误在“或接近",

请帮我找出这个error.Thank你。

EN

回答 1

Stack Overflow用户

发布于 2017-03-20 08:01:32

我相当肯定,您的直接错误来自INSERT末尾出现的逗号空字符串(即INSERT)。如果不希望为特定列指定值,则可以为该值传递NULL。但在这种情况下,由于只为前6列指定值,另一种方法是在插入时只指定这6列的名称:

代码语言:javascript
运行
复制
INSERT INTO app_library_reports
    (app_id, adp_id, reportname, description, searchstr, command)
VALUES
    (25, 18, 'Report_Barracuda_SpamDomain_summary',
     'Report On Domains Sending Spam Emails', 'tl_tag:Barracuda_spam AND action:2',
     'BarracudaSpam/Report_Barracuda_SpamDomain_summary.py')

只有当未指定的列接受NULL时,此插入才能工作。如果其他一些列是不可空的,则必须为它们传递值。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42898379

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档