plan_getmap=SPI_saveplan(SPI_prepare("select lt.tokid, pg_ts_cfgmap.dict_name from pg_ts_cfgmap, pg_ts_cfg, token_type( $1 ) as lt where lt.alias = pg_ts_cfgmap.tok_alias and pg_ts_cfgmap.ts_name = pg_ts_cfg.ts_name and pg_ts_cfg.oid= $2 order by lt.tokid desc;",2,arg));
if(!plan_getmap)
ts_error(ERROR,"SPI_prepare() failed");
}
sprintf(buf,"select lt.tokid, map.dict_name from %s.pg_ts_cfgmap as map, %s.pg_ts_cfg as cfg, %s.token_type( $1 ) as lt where lt.alias = map.tok_alias and map.ts_name = cfg.ts_name and cfg.oid= $2 order by lt.tokid desc;",nsp,nsp,nsp);
plan_getparser=SPI_saveplan(SPI_prepare("select prs_start, prs_nexttoken, prs_end, prs_lextype, prs_headline from pg_ts_parser where oid = $1",1,arg));
if(!plan_getparser)
ts_error(ERROR,"SPI_prepare() failed");
}
stat=SPI_execp(plan_getparser,pars," ",1);
nsp=get_namespace(TSNSP_FunctionOid);
sprintf(buf,"select prs_start, prs_nexttoken, prs_end, prs_lextype, prs_headline from %s.pg_ts_parser where oid = $1",nsp);