首页 > 解决方案 > 通过matlab执行postgresql命令

问题描述

我正在尝试通过 matlab 脚本在 PostgreSQL 中运行这行代码:

SELECT to_tsvector('english', 'a fat  cat sat on a mat - it ate a fat rats');

并得到这个结果:

 'ate':9 'cat':3 'fat':2,11 'mat':7 'rat':12 'sat':4

matlab脚本如下:

conn = database('servername','username','password');

query = "SELECT to_tsvector('english', 'a fat  cat sat on a mat - it ate a fat rats'); 
to_tsvector"; 
display(query) 
data =  fetch(conn,query);
        
close(conn)

当我在 matlab 中运行它时,出现以下错误:

JDBC Driver Error: ERROR: syntax error at or near "to_tsvector"
Position: 2

我不确定如何修复它,我需要能够通过 matlab 运行它。任何人都可以分享见解吗?

标签: postgresqlmatlabsyntax

解决方案


推荐阅读