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

git/master: admin backend failing at several places with postgresql error message #743

Closed
UweKrause opened this issue Aug 23, 2020 · 6 comments

Comments

@UweKrause
Copy link
Contributor

With the current version (master branch) and postgresql as db-engine, the admin backend fails at several places (New Entry, Edit Entries, Media library, Plugins, Users, Groups) due to a problem with postgresql SQL query string.
Fresh install, fresh debian 10, nothing else on this machine.

I use postgresql for the current stable version (2.3.5 as downloaded from the homepage: no problems) and for the master branch (problems).

php error Message below, the sql query is build in includes/functions.inc.php, starting here:

function serendipity_fetchUsers($user = '', $group = null, $is_count = false) {

According to git blame
( https://github.com/s9y/Serendipity/blame/bd3a9ec8324e3eb83409372dba7e0fe3ea03eb54/include/functions.inc.php#L363 ) the code for building the query was touched 3 month ago ( ac6c2d5 ) (after release 2.3.5).
Even if I so far don't understand what was changed there, my first bet would be to look at the commit.
The surrounding code is 14 years old, which might be a proof of being stable, or might be the problem ;-)

== ERROR-REPORT (BETA/ALPHA-BUILDS) ==

Warning: pg_query(): Query failed: ERROR: argument of WHERE must be type boolean, not type integer LINE 15: WHERE 1 ^ in /var/www/html/include/db/postgres.inc.php on line 222.
For more details set $serendipity['production'] = 'debug' in serendipity_config_local.inc.php to receive a stack-trace.



Fatal error:  Uncaught ErrorException: Warning: pg_query(): Query failed: ERROR:  argument of WHERE must be type boolean, not type integer
LINE 15:                                WHERE 1
                                              ^ in /var/www/html/include/db/postgres.inc.php:222
Stack trace:
#0 [internal function]: errorToExceptionHandler(2, 'pg_query(): Que...', '/var/www/html/i...', 222, Array)
#1 /var/www/html/include/db/postgres.inc.php(222): pg_query(Resource id #1, 'SELECT \n       ...')
#2 /var/www/html/include/functions.inc.php(452): serendipity_db_query('SELECT \n       ...')
#3 /var/www/html/include/admin/users.inc.php(176): serendipity_fetchUsers('')
#4 /var/www/html/serendipity_admin.php(142): include('/var/www/html/i...')
#5 {main}
  thrown in /var/www/html/include/db/postgres.inc.php on line 222

 == ERROR-REPORT (BETA/ALPHA-BUILDS) == 

Fatal Error: Uncaught ErrorException: Warning: pg_query(): Query failed: ERROR:  argument of WHERE must be type boolean, not type integer
LINE 15:                                WHERE 1
                                              ^ in /var/www/html/include/db/postgres.inc.php:222
Stack trace:
#0 [internal function]: errorToExceptionHandler(2, 'pg_query(): Que...', '/var/www/html/i...', 222, Array)
#1 /var/www/html/include/db/postgres.inc.php(222): pg_query(Resource id #1, 'SELECT \n       ...')
#2 /var/www/html/include/functions.inc.php(452): serendipity_db_query('SELECT \n       ...')
#3 /var/www/html/include/admin/users.inc.php(176): serendipity_fetchUsers('')
#4 /var/www/html/serendipity_admin.php(142): include('/var/www/html/i...')
#5 {main}
  thrown in /var/www/html/include/db/postgres.inc.php on line 222.
For more details set $serendipity['production'] = 'debug' in serendipity_config_local.inc.php to receive a stack-trace.



Fatal error:  Uncaught ErrorException: Fatal Error: Uncaught ErrorException: Warning: pg_query(): Query failed: ERROR:  argument of WHERE must be type boolean, not type integer
LINE 15:                                WHERE 1
                                              ^ in /var/www/html/include/db/postgres.inc.php:222
Stack trace:
#0 [internal function]: errorToExceptionHandler(2, 'pg_query(): Que...', '/var/www/html/i...', 222, Array)
#1 /var/www/html/include/db/postgres.inc.php(222): pg_query(Resource id #1, 'SELECT \n       ...')
#2 /var/www/html/include/functions.inc.php(452): serendipity_db_query('SELECT \n       ...')
#3 /var/www/html/include/admin/users.inc.php(176): serendipity_fetchUsers('')
#4 /var/www/html/serendipity_admin.php(142): include('/var/www/html/i...')
#5 {main}
  thrown in /var/www/html/include/db/postgres.inc.php:222
Stack trace:
#0 /var/www/html/include/compat.inc.php(254): errorToExceptionHandler(1, 'Uncaught ErrorE...', '/var/www/html/i...', 222)
#1 [internal function]: fatalErrorShutdownHandle in /var/www/html/include/db/postgres.inc.php on line 222
@UweKrause
Copy link
Contributor Author

@stephanbrunker since you made the last change, maybe you remember your intentions and can see quicker what might be wrong?

stephanbrunker added a commit to stephanbrunker/Serendipity that referenced this issue Aug 24, 2020
@stephanbrunker
Copy link
Contributor

stephanbrunker commented Aug 24, 2020

Already got it. Too much phpMyAdmin … there the default SQL for "fetch all" is "where 1" , but PostgreSQL doesn't seem to like that. I reordered the statements and changed '1=1' to '1' and that doesn't work. Corrected that. But I had to fix the function even if it was never changed since 14 years because with certain arguments (which obviously never occurred before), two 'WHERE' statements are generated in a single request which also would produce a SQL error.

@UweKrause
Copy link
Contributor Author

So should we close this issue?

@onli
Copy link
Member

onli commented Dec 25, 2020

@UweKrause Is this fixed for you when you edit your installation as shown in stephanbrunker@cb4530f ?

@UweKrause
Copy link
Contributor Author

UweKrause commented Dec 25, 2020

I don't have that installation anymore, but I created a new instance the same way as before with the code from the current master branch (therefore with the new changes).
It worked better this time.

This issue ("admin backend fails at several places (New Entry, Edit Entries, Media library, Plugins, Users, Groups)") might be closed.

After installation, the very first time entering the administration interface, there is another error (reproducible).
It goes away after a reload of the page.
Since this is another error with different behavior, I opened a separate issue. (#746)

@onli
Copy link
Member

onli commented Dec 26, 2020

Thanks for investigating this and for the new bug report, not many of us run s9y with postgres. I will close this issue then :)

@onli onli closed this as completed Dec 26, 2020
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

3 participants