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

does not execute and a large SQL query works when changing part of the code #917

Closed
OmlineEditor opened this issue Mar 16, 2025 · 4 comments

Comments

@OmlineEditor
Copy link
Contributor

Adminer version: 5.0.5
Driver: PostgreSQL
Database version: 16

I'm trying to output several tables for analysis.

SET my.ip_adr = '192.168.1.1';
SELECT * FROM public.count_records_by_ip(current_setting('my.ip_adr')::inet);
SELECT * FROM "del_client"        WHERE "ip_reg"          = current_setting('my.ip_adr')::inet ORDER BY "date_reg"          DESC    LIMIT 5;
SELECT * FROM "hacker_info"       WHERE "ip"              = current_setting('my.ip_adr')::inet ORDER BY "date_attack"       DESC    LIMIT 5;
SELECT * FROM "history_work"      WHERE "ip_address"      = current_setting('my.ip_adr')::inet ORDER BY "date_work"         DESC    LIMIT 5;
SELECT * FROM "pay_history"       WHERE "ip_pay"          = current_setting('my.ip_adr')::inet ORDER BY "date_pay_start"    DESC    LIMIT 5;
SELECT * FROM "registration_info" WHERE "ip_reg"          = current_setting('my.ip_adr')::inet ORDER BY "date_registration" DESC    LIMIT 5;
SELECT * FROM "registration_info" WHERE "ip_confirm"      = current_setting('my.ip_adr')::inet ORDER BY "date_registration" DESC    LIMIT 5;
SELECT * FROM "unique_ip"         WHERE "ip_address"      = current_setting('my.ip_adr')::inet ORDER BY "date_create"       DESC    LIMIT 5;
SELECT * FROM "user_cookies"      WHERE "ip_address_last" = current_setting('my.ip_adr')::inet ORDER BY "create_cookies"    DESC    LIMIT 5;

I see the code it worked well. then I change part of the SQL code and re-execute the query.

Image

the request goes to the server, there are no problems in the logs, but nothing changes on the screen

Image

if i reduce the size of the request then everything works fine

-- by reducing the size of the request the code works
SET my.ip_adr = '192.168.2.2';
SELECT * FROM public.count_records_by_ip(current_setting('my.ip_adr')::inet);
SELECT * FROM "del_client"        WHERE "ip_reg"          = current_setting('my.ip_adr')::inet ORDER BY "date_reg"          DESC    LIMIT 5;
SELECT * FROM "hacker_info"       WHERE "ip"              = current_setting('my.ip_adr')::inet ORDER BY "date_attack"       DESC    LIMIT 5;
@vrana
Copy link
Owner

vrana commented Mar 17, 2025

I couldn't reproduce this. First, can you try disabling JavaScript (Chrome Devtools > Ctrl+Shift+P > Disable JavaScript).

Second, is your new query displayed in the form?

Third, is your new query in history?
Image

Fourth, what's in the URL?

@OmlineEditor
Copy link
Contributor Author

  1. I can't turn off JavaScript, it breaks the entire site in the browser
  2. The new request is not displayed in the form.
  3. new request is not in history.
  4. The URL in the browser address bar does not change.

they helped me find the problem. The problem is in nginx, which has a small value for the URL length.

# part of the config in the file /etc/nginx/nginx.conf
client_body_buffer_size   2k;     
client_header_buffer_size 2k;     
large_client_header_buffers 2 2k; 

When resending a request, the request leaves the long URL address and in the browser's address bar builds an old request with an old address. This long address is not accepted by the server.

the first time you request an SQL query, it can be sent of any length because the URL is short. but a second request will not work because it comes from another long URL.

Is it possible to switch completely to a POST request and not use the sql=SET my.ip_adr ... parameter in the URL?

@vrana
Copy link
Owner

vrana commented Mar 17, 2025

Thank you for debugging this. Adminer actually doesn't use the URL parameter for anything in this case. It puts it there only to be available in the browser history so that you can quickly go back to it. There was a 2K limit just for the length of the command, I've shortened it to 500.

@vrana vrana closed this as completed in b7258d2 Mar 17, 2025
@OmlineEditor
Copy link
Contributor Author

I've shortened it to 500.

I looked at the average URL length for working with a database. Approximately 300 to 700 characters. I think the settings in other servers will be at least 1024 characters URL. Maybe increase the URL size a little so as not to cut the link? I think approximately from 500 to 800 characters, and there will still be 224 characters in reserve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants