Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgres page err #525

Open
lontten opened this issue May 9, 2024 · 1 comment
Open

postgres page err #525

lontten opened this issue May 9, 2024 · 1 comment
Labels
done done help wanted Extra attention is needed

Comments

@lontten
Copy link

lontten commented May 9, 2024

serde = { version = "1", features = ["derive"] }
rbs = { version = "4.5" }
rbatis = { version = "4.5" }
rbdc-pg = { version = "4.5" }

    let page_param = PageRequest::new(1, 10);
    let data = BookActive::select_page_by_name(db.as_ref(), &page_param,   & "a").await;

impl_select_page!(BookActive{select_page_by_name(book_name:&str) =>"
     if book_name != null && book_name != '':
       `where book_name like #{book_name}`
       "},"t_book");
 INFO  rbatis::plugin::intercept_log > [rbatis] [631024663232778246] => `select count(1) as count from t_book where book_name like ?` ["a"]
 INFO  rbatis::plugin::intercept_log > [rbatis] [631024663232778246] <= len=1
 INFO  rbatis::plugin::intercept_log > [rbatis] [631024664600121352] => `select * from t_book where book_name like ? limit 0,10` ["a"]
 INFO  rbatis::plugin::intercept_log > [rbatis] [631024664600121352] <= db:Notice { storage: b"SERROR\0VERROR\0C42601\0MLIMIT #,# syntax is not supported\0HUse separate LIMIT and OFF



@zhuxiujia
Copy link
Member

zhuxiujia commented May 9, 2024

postgres not support limit sql,
you need use Intercept edit sql limit to other

see https://github.com/rbatis/rbatis/blob/master/example/src/plugin_intercept_returing_id.rs

or, use your limit param

impl_select_page!(BookActive{select_page_by_name(book_name:&str,limit_sql:&str) =>"
     if book_name != null && book_name != '':
       `where book_name like #{book_name}`
       "},"t_book");

@zhuxiujia zhuxiujia added done done help wanted Extra attention is needed labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done done help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants