I am using postgresql-9.1.2-2
If I access to my host with the arguments user/random-user-name gets an fatal error from the database:
PDOException: SQLSTATE[22P02]: Invalid text representation
The error is produced because Drupal tries to search in the database which uid is similar to random-user-name, and since this is not a number (as it should be) and postresql seems to not support conditions like " WHERE (base.uid IN ('random-user-name')) " because it expects a list of numbers and not any string.

This error is found before any menu access callback is called. It is executed figuring out which default theme must be used, and it is called in drupal_bootstrap phase.

Instead this ugly database error Drupal should return any 404 error, as with MySQL happens.

Comments

xjm’s picture

Version: 7.12 » 8.x-dev
Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

So random-user-name means any-noninteger-string? Since the valid paths are user/N.

Let's have one more person confirm whether the following steps are sufficient to reproduce the issue:

  1. Install Drupal 8.x using the standard profile and a postgres database.
  2. Visit http://example.com/user/foo.

Thanks!

eldrupalista’s picture

Done, and it still crash.
Exactly, random-user-name is any string.
I have created a patch for this:
File: core/modules/user/user.module

function user_load($uid, $reset = FALSE) {
  if(!is_numeric($uid)){
	return FALSE;
  }
  $users = user_load_multiple(array($uid), array(), $reset);
  return reset($users);
}

Since user_load expects for an Integer it doesn't make sense continue searching if the $uid parameter is not an Integer. This not only fix the bug, it also saves time.

eldrupalista’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community
xjm’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

Still postponed for more info per #1.

jhedstrom’s picture

Version: 8.0.x-dev » 7.x-dev
Component: postgresql database » ajax system
Issue summary: View changes

We now have automated tests for pgsql on 8.x, so this is almost certainly fixed there. Bumping to 7.x, but could probably be closed due to inactivity.

Status: Postponed (maintainer needs more info) » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.