For some reason one of the sites I manage occasionally gets someone trying to access a view with a negative page offset, e.g. http://www.example.com/events?page=-1. This causes the following error in PostgreSQL:

pg_query(): Query failed: ERROR: OFFSET must not be negative in [path_to_drupal]/includes/database.pgsql.inc on line 138.

I've attached a patch for views_plugin_query_default.inc that sets the offset to 0 if it's a negative value.

CommentFileSizeAuthor
views_negative_offset.patch784 bytesChrisLaFrancis

Comments

dawehner’s picture

Status: Active » Needs work

Update status.

I guess it would probably make sense to add some validation as well.

mustanggb’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)