Delete a user (postgresql) has invalid sql

Found a bug? Tell us!!
Post Reply
petree2
Regular
Posts: 13
Joined: Wed Mar 09, 2005 9:56 pm

Delete a user (postgresql) has invalid sql

Post by petree2 »

When i went to delete a user it puked (see bottom)

I am running postgresql 7.4 something. The limit clause is not valid on a delete statement. Also why is there a userlevel clause?

The statement (as far as I can tell) should just be.

DELETE FROM serendipity_authors WHERE authorid=3


Error message:

Code: Select all

Warning: pg_query(): Query failed: ERROR: syntax error at or near "LIMIT" at character 71 in /var/www/duckies.org/serendipity/include/db/postgres.inc.php on line 107
Error in DELETE FROM serendipity_authors WHERE authorid=3 and userlevel <= 255 LIMIT 1
ERROR: syntax error at or near "LIMIT" at character 71
array (
  0 =>
  array (
    'file' => '/var/www/duckies.org/serendipity/include/functions_config.inc.php',
    'line' => 20,
    'function' => 'serendipity_db_query',
    'args' =>
    array (
      0 => 'DELETE FROM serendipity_authors WHERE authorid=3 and userlevel <= 255 LIMIT 1',
    ),
  ),
  1 =>
  array (
    'file' => '/var/www/duckies.org/serendipity/include/admin/users.inc.php',
    'line' => 23,
    'function' => 'serendipity_deleteauthor',
    'args' =>
    array (
      0 => '3',
    ),
  ),
  2 =>
  array (
    'file' => '/var/www/duckies.org/serendipity/serendipity_admin.php',
    'line' => 210,
    'args' =>
    array (
      0 => '/var/www/duckies.org/serendipity/include/admin/users.inc.php',
    ),
    'function' => 'include',
  ),
)
DELETE FROM serendipity_authors WHERE authorid=3 and userlevel <= 255 LIMIT 1
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Delete a user (postgresql) has invalid sql

Post by garvinhicking »

Thanks a lot. I removed the irrelevant LIMIT 1!

The userlevel is just there as an extra precaution against abuse for using the API function on non-authorised users.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
petree2
Regular
Posts: 13
Joined: Wed Mar 09, 2005 9:56 pm

Re: Delete a user (postgresql) has invalid sql

Post by petree2 »

garvinhicking wrote:Thanks a lot. I removed the irrelevant LIMIT 1!

The userlevel is just there as an extra precaution against abuse for using the API function on non-authorised users.
Except that your checking the userlevel of the user you are deleting, not the current user.

Oops! ;)
Post Reply