sqlc
sqlc copied to clipboard
MATCH AGAINST not working in MYSQL
Version
1.9.0
What happened?
Code generated doesn't include function parameters for against field.
Relevant log output
No response
Database schema
No response
SQL queries
No response
Configuration
No response
Playground URL
No response
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
The playground link you posted isn't working. Can you include the SQL and JSON here in the issue?
select produto_sku, produto_nome, 'P' as tipo, familia_id, ifnull(produto_tipo,'') as produto_tipo, categoria_title,
categoria_id, sub_categoria_nome, indicado_descricao, indicado_id, categoria_nome,
match(produto_termo_chave) against("dipirona") as vl_match ,
if(match(produto_termo_chave) against("dipirona" IN BOOLEAN MODE) > 0, 1,
if(match(produto_principio_ativo) against("dipirona" IN BOOLEAN MODE) > 0, 3,
if(match(indicado_descricao) against("dipirona" IN BOOLEAN MODE) > 0, 4,
if(match(sub_categoria_nome) against("dipirona" IN BOOLEAN MODE) > 0, 5, 6)))) as tipo_resultado,
produto_qtde_ofertas, if(ifnull(produto_qtde_ofertas,0) = 0, 'N', 'S') as disponibilidade
from tbl_produto_autocomplete
where (match(produto_termo_chave) against("dipirona" IN BOOLEAN MODE))
or (match(sub_categoria_nome) against("dipirona" IN BOOLEAN MODE))
or (match(produto_principio_ativo) against("dipirona" IN BOOLEAN MODE))
or (match(indicado_descricao) against("dipirona" IN BOOLEAN MODE))
order by categoria_id, disponibilidade desc, tipo_resultado, produto_qtde_ofertas desc, produto_nome;
@kyleconroy this query is a good example. sqlc cannot generate it and throws an exception near > 0,1.
Just for some additional context / example here, here's a simple playground link. Been trying sqlc.arg w/ no success. Any ideas here for a workaround?
Encountered the same issue. sqlc seems to ignore parameter inside a match against(?) clause