manticoresoftware / manticoresearch

Easy to use open source fast database for search | Good alternative to Elasticsearch now | Drop-in replacement for E in the ELK soon
https://manticoresearch.com
GNU General Public License v3.0
8.97k stars 498 forks source link

PostgreSQL foreign table #917

Open montredo opened 2 years ago

montredo commented 2 years ago

I'm trying to connect to Manticore Search via foreign table in PostgreSQL and when executing a query I get the error:

[HV00L] ERROR: failed to prepare the MySQL query: unknown command (code=22)

What I was doing:

1) Created a table in Manticore:

create table test_table  
(  
    title text,  
    description text,  
    created_at timestamp  
)  
blend_chars = ' , #'  
html_strip = '1';  

2) In PostgreSQL executed the following queries:

create extension mysql_fdw;  
create server manticore foreign data wrapper mysql_fdw options (host '127.0.0.1', port '9306', reconnect 'true');  
create user mapping for postgres server manticore options (username 'root', password '');  

create foreign table manticore_test_table  
(  
    id bigint,  
    title text,  
    description text,  
    created_at timestamp with time zone  
) server manticore options (table_name 'test_table');  

select * from manticore_test_table; -- get error  

Manticore Search version: 5.0.2
PostgreSQL version: 15
postgresql-mysql-fdw version: 2.8.0

Manticore config:

common {  
    plugin_dir = /usr/local/lib/manticore  
}  

searchd {  
    listen = 127.0.0.1:9306:mysql  
    log = /var/log/manticore/searchd.log  
    query_log = /var/log/manticore/query.log  
    pid_file = /var/run/manticore/searchd.pid  
    data_dir = /var/lib/manticore  
    query_log_format = sphinxql  

    mysql_version_string = 5.7.38  
}  
githubmanticore commented 1 year ago

➤ Sergey Nikolaev commented:

It's turned out that the problem is that PostgreSQL does "prepare" + "execute" while trying to pass a query to Manticore which Manticore doesn't understand since these mysql protocol methods are not implemented in Manticore. So do solve this task we first need to have them implemented.